On this Page
Table of Contents | ||||
---|---|---|---|---|
|
Snap type: | Transform | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: | This Snap mimics an IF statement in most programming languages. Each row of the conditional table is equivalent to an if/else if block in an if statement. The default value property is equivalent to the else block of an if statement. Similar to an if statement, the first conditional that evaluates to true will have its value set into the provided target path. No other conditionals will be evaluated once one evaluates to true. If no conditionals evaluate to true, then the default value (if set) will be written to its provided target path. However, the Snap will evaluate all conditionals and write return values to the Conditional's corresponding target path if the evaluate all property is set.
| ||||||||||||||
Prerequisites: | [None] | ||||||||||||||
Support and limitations: | Ultra pipelines: Works in Ultra Pipelines. Spark mode: Not supported in /wiki/spaces/SD/pages/1437917 mode. | ||||||||||||||
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. | ||||||||||||||
Evaluate all | Required. Evaluates all the conditionals and writes all the return values to the target paths if the conditional evaluates to true. Example with Evaluate All true :
For an input document:
would return a document
because both conditionals evaluate to true. | ||||||||||||||
Null-safe access | Enabled: Lets you set the target value to null in case the source path does not exist, such as $person.phonenumbers.pop() ->$ lastphonenumber can result in an error in case person.phonenumbers does not exist on the source data. Enabling this allows to write null to lastphonenumber instead. | ||||||||||||||
Conditional table | Required. Contains the conditional, return value, and target path for a block in the if/else if statement.
| ||||||||||||||
Default Value | Default value to assign if none of the conditionals evaluate to true. Example:
is equivalent to:
| ||||||||||||||
|
|
Examples
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|