Tips & Tricks - Write Data to File
There has been some changes around procedure CREATE_OUTPUT_FILE. Writing data
has become more flexible, and it is possible to build attribute-strings and call
procedures while reading from the data source. More details below.
Contents
- Earlier, View Name was the only Data Source available. For complex output,
we always had to
create a view first.
- Now, column Source Name is available, enabling us to select data from multiple
data sources.
- And of course, we can add a WHERE-clause to complete a JOIN, f.ex.
As we used INVENTORY_PART as View Name, the columns from this view is automatically
added to folder File Mapping and we have made following configuration :
- Enter a Pos for those columns that should be written to the file
- Prefix columns with Alias were needed. Column Name is a key-column, so we
cannot edit it
directly, perform F7/F6 (delete/duplicate) in succession, and add alias to the
new row before saving.
- You may add SQL-expressions, and give them a column-alias.
- The columns with Pos=0 will be used to build an Attr-string to the procedure
defined on Rule
CALLEXTPROC.
Note that some of them are 'hardcoded' (Fixed Value), but ROWID is selected
from the data source.
As this is a JOIN, we have to prefix this column with the table-name. (No alias)
- Rule FILEHEAD gives us a column-header on the file. This is a client-file,
so we have to fetch it from
Execute Job window, folder Details. (use Output Channel).