Jitterbit Success Central will be undergoing system maintenance and may be inaccessible during this time: November 5 at 11 to 3 pm PST; 5 November at 19:00 to 23:00 UTC; 6 November at 6 to 10 am AEDT.

Versions Compared

Key

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

Introduction

Conditional mapping lets you specify that a record in a transformation is mapped based on a defined condition. The condition determines (yes or no) if the record is mapped. As part of that determination, you can include logic to set what values are used in the mapping. For example, a record might be used only if the size of a text field is less than a specified maximum.

Conditional mapping is accomplished by adding a special data element called a condition node to a target folder. The contents of the condition node specifies the condition for generating the record. A condition must return a true (1) or false (0) value. It can contain other logic, and a side effect of that logic can be to set the value of other nodes in the transformation.

There can be only one condition node in a target folder. Thus, all logic for the condition must reside in that condition.

The condition node is always evaluated before any target fields are evaluated. This means that all logic for creating or determining the values for those target fields must be in the condition node if the condition node requires those values in order to complete its determination.

If multiple conditions are present, they are evaluated in the order from outer node to inner node; if they are on the same level, then they are evaluated in the order from top to bottom.

Info
NOTE: Condition nodes apply only to optional or loop target folders (also known as Target Loop Nodes or TLNs).

Creating a Condition Node

To define a condition:

  1. Select the folder to which the condition will apply:

     

  2. Below the transformation mapping, click on the multiple folders icon  to bring up display the Mapping Options dialog. For information on all available options, see Add Extra Folders under Mapping Flat to Hierarchical Structures.

  3. Select Enable condition on current folder and click OK.

  4. The folder you selected will now display a new Condition data element below the node to which you have applied the condition:

Applying a Formula to the Condition Node

You now have a condition applied to your target. In order for it to be operational, you must apply a formula:

  1. Double-click on the condition in the target tree:

  2. The Formula Builder will open. In the script area in the top left, enter an expression that is appropriate for your condition using a combination of formulas, values of source data elements, and mathematical operators.
  3. The formula must return either true (1) or false (0) to determine if the mapping for the given record occurs.

Examples

To set a condition such that a record is used only if its flag to publish it was set, you could use a condition such as: 

Code Block
<trans>
bool(Publish_To_Community__c) == true
</trans>

To set a condition such that a record is used only if it is less than a maximum size, assuming that the article text is in the element json$results$item.body$view$value$:

Code Block
<trans>
pass = true;

// Log article size
$articleDetailsSize = Length(json$results$item.body$view$value$);
WriteToOperationLog('Current article:' + 
    json$start$ + ' articleDetailsSize:' + $articleDetailsSize);

// Checks if the article size > $MaxArticleDetailSize;
// if so, the article is ignored
if($articleDetailsSize > $MaxArticleDetailSize, 
    WriteToOperationLog("Ignoring Id " + json$results$item.id$ + 
        " as too large (" + $articleDetailsSize + ")");
    pass = false;
);

pass;
</trans>

A condition formula can also set values used in other nodes. Using the above example, the condition node can as part of its logic set the intended contents of a field to a global variable:

Code Block
<trans>
...
$articleDetails = Replace(json$results$item.body$view$value$,
                          'href="/','href="https://example.com/');
...
</trans>

The global variable is then used to set the value in the desired target field Article_Details__c:

Code Block
<trans>
$articleDetails;
</trans>
Panel
borderColor#65379B
titleColor#FFFFFF
titleBGColor#65379B
titleOn This Page
Table of Content Zone

Table of Contents
maxLevel3
minLevel2
indent20px

Panel
borderColor#FF7C4C
titleColor#FFFFFF
titleBGColor#FF7C4C
titleRelated Articles
Content by Label
showLabelsfalse
max1000
showSpacefalse
sorttitle
cqllabel = "condition" and space = "DOC"
Panel
borderColor#00B886
titleColor#FFFFFF
titleBGColor#00B886
titleRelated Topics
Content by Label
showLabelsfalse
max1000
showSpacefalse
sorttitle
cqllabel in ("transformation-overview","target-overview","formula-builder-overview") and space = "DOC"

HideElements
metastrue

Last updated: 

Lastmodifieddate