We recommend switching to the latest versions of Edge, Firefox, Chrome or Safari. Using Internet Explorer will result in a loss of website functionality.

Conditional Columns

Comments

1 comment

  • Avatar
    Adrian Williams

    Hi Dinesh,

    I assume this question relates to your other post on the forum about the conditional propagation of a data set through a data flow. 

    However, to answer your specific questions in this post:

    No, you cannot configure the output metadata of the Transform node based on the input record count as this information is not directly available to the ConfigureFields script. 

    In the Transform node the ConfigureFields script is run once when the node initially starts to run. This occurs before the first record is processed so it is not possible to access any field values in the first input data record. The ProcessRecords script is run for each input record.

    All output metadata must be configured within the ConfigureFields script. The ConfigureFields script can access the values derived from property references - i.e. Run property values, Data flow property values as well as Composite/ local node property values (See the Advanced topics > Using derived property values topic in the Help documentation).

    The ConfigureFields script can access the input metadata, meaning you can use this information to determine the output metadata from the node, for example:

    Suppose you wanted to use the Transform node to process some order data. Your input data may or may not contain a field called 'SalesTax' and you only want to output a field that holds the 'TotalSalesTax' if the input data contains the 'SalesTax' field.

    In the ConfigureFields script in-built  fields variable holds the input metadata (see the Python scripting > API and script bindings topic in the Help for further details). The script validates whether the required field name is contained in the input metadata. If it is the 'TotalSalesTax' field is added to the output record metadata.

     

     

    Within the ProcessRecords script a variable is initialized to hold the computed total and the total is adjusted for each processed record - provided the 'SalesTax' field existed in the input data (and that the value is not Null).

    Finally, the calculated total tax value is output on the final record of the data. Note that it is necessary to ensure the output record values correspond with the previously defined output metadata, else the node will generate an error.

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.