For each properties using condition

 

Situation:

We want to use for each properties in mapper. In fact,

We have 2 DB Queries:

1. Query name

2. Query Type

We have ForEach variable like WHEN CONDITION{ $var = 1} VALUE=[Query Name ] OTHERWISE VALUE=[Query Type ]

Now, we would like to make this when condition (i.e. ForEach variable) in For each properties.

We should have Query Name/Record in for each properties when $var =1, otherwise Query Type/Record.

 

Solution:

1) Create local variables at root level in the Data Mapper.

S.No.

Local Variable Name

Local Variable Value

1

dbQuery_QueryName

DBQuery{arg1,arg2,arg3}

2

dbQuery_QueryType

DBQuery{arg1,arg2,arg3}

3

whenCondition

WHEN CONDITION{$var = 1}VALUE=[$dbQuery_QueryName] OTHERWISE VALUE=[$dbQuery_QueryType].  Descripton : We are assuming that ‘$var’ variable has been declared by you in advance at root.

 

2) Apply below “Textual Rule” on record.

IFF CONDITION{$var =1 } VALUE=[true]


3) Go to properties tab in the above image and apply for-each with value : “$dbQuery_QueryName /Record

 

 

4) Now create a clone for the Record by following the below steps :

  • Right click on “Record” node.
  • Click “Clone Node” option

  •  Press OK button in “Clone Options” pop-up box without selecting any check-box 

 

 

 

  • A clone of Record node would created with name : ‘Record[1]’.

 

5) Double click on ‘Record[1]’ and go to “Textual Rules” tab and implement the exactly opposite filter condition as implemented on ‘Record’

 e.g; IFF CONDITION{$var != 1  } VALUE=[true ]



6) Now go to “Properties” tab on the ‘Record[1]’ node and assign for-each value : ‘$dbQuery_QueryType /Record’