cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical mapping:Recurring nodes based on the value in one of the field

0 Kudos
529

Dear Experts,

I need to replicate the root node based on the value in one of the fields, please suggest if there is any option to achieve it using graphical mapping.

Input XML:

<example_MT><Records>

  • <field1>1</field1>
  • <Loc>IN</Loc>
  • <Count>3</Count>

</Records></example_MT>

If value of count is more than 1, as it is in above example, it should create target nodes with the count value as below:

<example_MT><Records>

  • <field1>1</field1>
  • <Loc>IN</Loc>
  • <Count>1.1</Count>

</Records>

<Records>

  • <field1>1</field1>
  • <Loc>IN</Loc>
  • <Count>1.2</Count>

</Records>

<Records>

  • <field1>1</field1>
  • <Loc>IN</Loc>
  • <Count>1.3</Count>

</Records></example_MT>

Thanks,

Sudhir

View Entire Topic
0 Kudos

Finally I was able to get the required result. Initially I was trying to do everything at the record level, which could be confusing with changing context at every level. Now I'm using the same UDF at both Record and field level.

UDF:

Execution Type: All values of queue

Two arguments: Var1: String, Var2: Integer

for(int i=0;i<var1.length;i++)

{ for(int j=0;j<var2[i];j++)

{ result.addValue(var1[i]);

}

}

Record level Mapping:

Pass "Records" as first argument and "Count(data type: Integer)" as second argument, will create the correct output structure.

Field level Mapping:

Pass "field1" as first argument and "Count" as second argument, then pass the output of this UDF with Node function "SplitByValue(each value)" It'll populate the correct value in the output structure.

Same has to be done for all other fields.

Regards,

Sudhir