Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

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.

Conditionals and return values can be created using the expression language defined here.

Note
If there is no condition, no data can flow through.


Prerequisites:

[None]


Support and limitations:Ultra pipelines: Works in Ultra PipelinesSpark mode: Not supported in /wiki/spaces/SD/pages/1437917 mode.
Account: 

Accounts are not used with this Snap.


Views:


InputThis Snap has exactly one document input view.
OutputThis Snap has exactly one document output view.
ErrorThis Snap has at most one document error view and produces zero or more documents in the view.


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 :

 ConditionalReturn Value Target Path
 $State == "CA""California" $FullName
 $id == 1 "found" 

 $status



For an input document:

Code Block
{
    State: "CA",
    id: 1
}


would return a document

Code Block
{
    State: "CA",
    id: 1,
    FullName: "California",
    status: "found"
}

because both conditionals evaluate to true.

Default value: Not selected


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. 
Disabled: Fails if the source path does not exist or ignores the record entirely or writes the record to the error view depending on the setting of the error view property.


Conditional table
 

Required. Contains the conditional, return value, and target path for a block in the if/else if statement.

Example

 Conditional   Return Value Target Path
 $State == "CA""California" $FullName
 $State == "NJ" "New Jersey"  $FullName


Is equivalent to:
 

Code Block
if($State == "CA") {
    return "California";
} else if ($State == "NJ") {
    return "New Jersey";
}

Default Value
Default value to assign if none of the conditionals evaluate to true.

Example

 Default ValueDefault Value Path
 "N/A" $FullName


is equivalent to: 

Code Block
else {
return "N/A";
}

 

Multiexcerpt include macro
nameSnap Execution
pageAnaplan Read


Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read

Examples


 

Insert excerpt
Transform Snap Pack
Transform Snap Pack
nopaneltrue