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

Define Data Source

  1. Earlier, View Name was the only Data Source available. For complex output, we always had to
    create a view first.
  2. Now, column Source Name is available, enabling us to select data from multiple data sources.
  3. And of course, we can add a WHERE-clause to complete a JOIN, f.ex.


Define Columns and Update Source Table

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 :

  1. Enter a Pos for those columns that should be written to the file
  2. 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.
  3. You may add SQL-expressions, and give them a column-alias.



  4. 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)
  5. 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).