results
Returns a list of streams of the specified result, optionally filtered by name. Use the function nth to access a particular value in the list.
Signature
results(result:result, name:string) -> list of stream |
Parameters
Name | Type | Description |
---|---|---|
result | result | Mandatory parameter. The result of the step from which you want to return a list of streams. |
name | string | Optional parameter. When provided, filters by name a particular value in the result. |
Examples
Example A. Let's suppose that you have deployed to FlowForce Server a mapping that generates a single XML file as output. An example of such a mapping is CompletePO.mfd included with MapForce examples. The name of the target XML component in MapForce is "CompletePO". To process the result of this mapping and save it to a file from FlowForce, configure the job as follows:
In the job configuration above, the first step runs the mapping and returns the result as mapping_result. In the second step, the expression
{as-file(nth(results(mapping_result), 0))} |
processes the mapping_result and converts it to a file. Namely, the results function picks the list of streams from the MapForce component. The nth function picks the first item from this list. Finally, the as-file function generates a file from the stream.
The copy function copies the generated file to the working directory. The Target text box defines the name of the generated file. Any existing file with the same name will be overwritten.
Example B. Let's suppose that you have deployed to FlowForce Server a mapping that has two target XML components, "MarketingExpenses" and "DailyExpenses". An example of such a mapping is MarketingAndDailyExpenses.mfd included with MapForce examples. To generate a file from the "DailyExpenses" component, create a job similar to the one above, but change the expression to:
{as-file(nth(results(mapping_result,'DailyExpenses'), 0))} |
The only difference here is that the list of streams produced by the mapping is filtered by the name of the desired component (in this case, "DailyExpenses").
Example C. Let's suppose that you have deployed to FlowForce Server a mapping that generates multiple XML files dynamically. The output file names are generated by the mapping itself and are not known before runtime. An example of such a mapping is DividePersonsByDepartmentIntoGroups.mfd included with MapForce examples. To generate the third output file of the mapping, create a job similar to the one above, and change the expression to:
{as-file(nth(results(mapping_result), 2))} |
Here we need the third file, so the index supplied as second argument to the nth function is 2 (not 3), because the index is zero-based.
See also the following examples:
•Creating a Job from a StyleVision Transformation
•Generate Multiple PDFs from Multiple XMLs