Access the Mapping/Transformation Result
After a MapForce mapping or StyleVision transformation has been deployed to FlowForce Server, it becomes a FlowForce function which can be called from other execution steps. For example, in the first step of the job below, a mapping function called SimpleTotal.mapping is being executed.
Notice that the job consists of two steps:
1.Step 1 calls MapForce Server to actually run the SimpleTotal.mapping function. Importantly, the Assign this step's result to field gives a name to the mapping result (in this case, it is output; however, it can be any name you choose).
2.Step 2 calls the /system/compute function which converts the output of the mapping to a stream.
By default, the output of a mapping or transformation function is of generic type result. In order for the output to become useful, result must be converted to whatever data type you require (for example, string, stream, file). For this purpose, the /system/compute built-in function is available, as well as various FlowForce expression functions. In the example above, the built-in function /system/compute was called to perform the required data type conversion. Namely, the expression stdout(output) converts the result of the previous step to a stream.
The table below lists examples of FlowForce expressions that you will likely need to process the result of a mapping or a transformation function. Remember that, in all these examples, output is the name you entered in the Assign this step's result to field.
Converts output to a stream.
Converts output to string.
Converts output to a file.
This kind of expression is required if output consists of multiple files. This happens when the mapping or transformation function was designed (in MapForce or StyleVision) to generate not just a single output, but multiple outputs. The expression converts output to a sequence of streams, picks up the first stream from the sequence, and converts it to file. For an example, see Creating a Job from a StyleVision Transformation.
as-file(nth(results(output, "CompletePO"), 0))
Same as above, except that the file is retrieved from the sequence of streams not by its zero-based index as above, but by name (in this case, "CompletePO").
For complete reference to FlowForce expression functions that are available to handle the result of a step or job, see Step Result Functions. For an introduction to FlowForce expressions, see FlowForce Expressions.