Note |
---|
The ForEach Snap is being phased out in favor of the Pipeline Execute Snap. |
Snap type: | Flow | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Description: | This Snap can be used to invoke a new pipeline for each of the incoming documents. The incoming document can hold the pipeline parameters that are required to run the pipeline.
| |||||||||
Prerequisites: | None | |||||||||
Support and limitations: | ||||||||||
Account: | Accounts are not used with this Snap. | |||||||||
Views: |
| |||||||||
Settings | ||||||||||
Label | Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline. | |||||||||
Pipeline | Required. The pipeline that should be executed for each incoming document. Default value: Null | |||||||||
Snaplex | Snaplex where the pipeline will be run. If this field is left empty, the pipeline will be run on the runtime path where the ForEach Snap is executing. Default value: [None] | |||||||||
Execution mode | Required. Execution mode for running the pipeline. The options available include:
If execution mode is set to SYNCHRONOUS mode, the ForEach Snap will wait for each pipeline execution to complete before reading the next document from the input view. In case of FIRE_AND_FORGET mode, pipeline execution is scheduled and the pipeline run id is written to the output view and ForEach Snap will proceed with next input. Default value: SYNCHRONOUS | |||||||||
Batch size for synchronous mode | When Synchronous mode is selected, pipeline execution will be carried out in batch. When the batch size is reached, this Snap will wait for all the executions in the batch to complete before proceeding. | |||||||||
Pipeline parameters | Pipeline parameters that should be used for executing the pipeline can be configured in this property. The Parameter name is the name of the parameter that should be used while executing the pipeline. You can select the pipeline parameters defined for the pipeline selected in the Pipeline field. The Parameter value is the expression property that can be configured as an expression based on incoming document or can be a constant. If it is configured as an expression based on the incoming document, each incoming document will be evaluated for the given expression and the value is set as the parameter value for the parameter name while invoking the pipeline. Default value: [None] | |||||||||
Maximum instances | Required. In the SYNCHRONOUS mode, this property is the maximum number of times the ForEach Snap can call its own pipeline recursively. In this mode, you should have a logic built within the pipeline so that the pipeline execution completes gracefully before the number of instances reaches to the value of this property. Otherwise, the Snap will throw an error. The last instance in the nested pipelines will show an error "The maximum number of recurring pipeline instances has reached in the synchronous mode, Maximum instances: ...", and the rest will show "Error occurred while waiting for the pipeline to complete the execution". In the FIRE_AND_FORGET mode, this property is the maximum number of the instances of which the recurring pipelines can run at any given time. Therefore, in the mode, the pipeline runs forever recursively while the number of the pipeline instances in progress is limited to the value of this property.
Default value: 50 | |||||||||
Execute during preview | Executes the Snap during a pipeline Save operation so that the output view can produce the preview data. Default value: Not selected |
| Select one of the three modes in which the Snap executes. Available options are:
|
---|
Note |
---|
When using a ForEach Snap, the state of the child pipeline configured in the pipeline parameter of the Snap is represented in the $state value, which is the default element in the output document. This can be very useful for flow Snaps such as Filter (expression example: $state == "COMPLETED"). |
Examples
The following pipelines show how to use the ForEach Snap to write multiple files. The first pipeline reads a JSON document that contains a list of zip codes and Snaplexes. The ForEach Snap then calls the second pipeline three times, once for each zip code entry. |
Pipeline Downloads
Attachments | ||
---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|