cancel
Showing results for 
Search instead for 
Did you mean: 

UDF to create Multiple Nodes in the Target

ravi_teja14
Participant
0 Kudos

Hi Team,

Need to create the Target node based on the input . If the Source node "Employee " occurance is 1 then in the target 3 nodes to be create.

If Source is having 2 "Employee" nodes then in the target 6nodes to be populate.

Source Target

Employee EmployeeDetails

EmployeeDetails

Employee Details

Thanks,

Ravi

manoj_khavatkopp
Active Contributor
0 Kudos

Please provide a sample input and expected output xml.

ravi_teja14
Participant
0 Kudos

Hi Manoj,

we have requirement to populate the 3 lineitems in the Target structure , For each Sale need to create 3 lineitems , the data present in Sale1 & Sale2 need to be populate in the relevant LineItems

Sale 1 LineItem11

LineItem12

LineItem13

Sale2 Lineitem21

Lineitem22

Lineitem23

Thanks,

Ravi

Accepted Solutions (0)

Answers (2)

Answers (2)

ravi_teja14
Participant
0 Kudos

Thanks Tanu,

The Lineitem structure is not repeating in the target structure, only the "item" name is repeating.

if the sequenence number is "1" in the source then it should be populate in the target structure 3 times as Lineitems.

Example:

Sequence Number 1 item

RetailSequenceNumber 1

item

RetailSequenceNumber 1

item

RetailSequenceNumber 1

Sequence Number 2 item

RetailSequenceNumber 2

item

RetailSequenceNumber 2

item

RetailSequenceNumber 2

lineitemstructure-is-not-repating-in-the-targetstr.jpg

Former Member
0 Kudos

Ravi,

If that is the case, apply this UDF to every field in the structure and use split by each value after that.

ravi_teja14
Participant
0 Kudos

Hi Tanu,

I have applied the same logic but it was fail for multiple or Too many values in the Source.

Any thoughts...fail-for-multiplevalues.jpg

Former Member
0 Kudos

Hi Ravi,

Try below UDF . Execution type = all values of queue and input= var1

int a= var1.length;

int b=3*a;

for(int i=0;i<b;i++)

{

result.addValue("");

}

ravi_teja14
Participant
0 Kudos

Hi Tanuja,

The UDF is creating 9 line items in the target structure.

Thanks,

Ravi

ravi_teja14
Participant
0 Kudos

Hi Tanuja,

Now the 6 Lineitems are created but the data need to be populate in the relevant Lineitems.

Any thoughts please.

Thanks,

Ravi