See information about the latest product version
Record selection expressions
The record selection expression is used to select a record from a file to propagate to the rest of the flow.
Each record in turn is compared to the expression, and the first one to evaluate to true is propagated to the Out terminal. You can set the expression to any valid XPath expression that returns a Boolean value. The expression is not used when Whole File is selected as the Record Detection option.
Correlation names used in the expression
- InputRoot and InputLocalEnvironment
- The Input names refer to the incoming message that enters the node through the In terminal
- ResultRoot
- The ResultRoot name refers to the message created by using the current record in the file.
- OutputRoot
- The OutputRoot name refers to the message that is propagated if the expression evaluates to true. This action is identical to ResultRoot, unless the Output data location or Result data location have been changed to copy the Result message found in the file to a different location in the outgoing message.
- OutputLocalEnvironment
- The OutputLocalEnvironment contains the normal local environment which is propagated down the Out terminal and contains useful information like the number of the record and its offset.
Any combination of data in these correlation names can be used, along with any valid XPath expression, to determine whether to propagate the record.
Examples
$InputRoot/XMLNSC/Invoice/AccountNumber=$ResultRoot/XMLNSC/Data/Key
In this example, each record is a valid XML document. The FileRead node reads each record from the file. In the incoming message the FileRead node compares the field /Data/Key to the field /Invoice/AccountNumber. If the record matches, it is propagated to the Out terminal.
$OutputLocalEnvironment/File/Read/RecordNumber=5
The FileRead node reads each record from the file and compares the record number to 5. The record is propagated when it reaches the fifth record.
Building an outgoing message by using an incoming message combined with a record from a file
- Input
- The Input message assembly contains all the data in the incoming message and is the basis for the propagated record.
- Result
- The Result message assembly contains the record read from the file.
- Output
- The Output message assembly is the actual object propagated from the node.
By default, the Output message assembly is constructed by copying the Input message assembly to the Output message assembly. The data part of the Output message assembly is then replaced by the contents of the Result message assembly and the OutputLocalEnvironment is updated with details of what happened in the node.
- Result data location
- Specifies which part of the read record is copied to the Output message. By default, the Result data location copies everything from ResultRoot but it can be changed to copy only part of the record. For example: ResultRoot.XMLNSC.Invoice.Name just copies the name field from the selected record to the output message.
- Output data location
- Specifies where the record is copied to in the outgoing message. By default, the Output data location copies everything to OutputRoot. The location specified can be in the data part of the message (under ResultRoot) or in any other Output tree like OutputLocalEnvironment. For example: To copy the resulting record to a field in the message body OutputRoot.XMLNSC.Invoice.Data or to copy the result to local environment OutputRoot.Variables.Invoice.data.
- Copy local environment
- Causes the local environment to be copied from the InputLocalEnvironment. If the Copy local environment option is not selected, the InputLocalEnvironment is used directly without copying. This option allows nodes before the FileRead node to see changes to the Local environment.
Result data location= ResultRoot.XMLNSC.Invoice.Name
Output data location= OutputRoot.XMLNSC.Invoice.Name
Result data location= ResultRoot.XMLNSC.Invoice
Output data location= OutputLocalEnvironment.Variables.Invoice