Skip to Content
0

UDF to create Multiple Nodes in the Target

Aug 16, 2017 at 08:32 PM

65

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded

Please provide a sample input and expected output xml.

0
Former Member

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

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

avatar image
Former Member Aug 17, 2017 at 08:48 PM
0

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


Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Ravi,

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

0
Former Member

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

0
avatar image
Former Member Aug 17, 2017 at 03:26 PM
0

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("");

}

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Tanuja,

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

Thanks,

Ravi

0
Former Member
Former Member

Hi Tanuja,

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

Any thoughts please.

Thanks,

Ravi

0