cancel
Showing results for 
Search instead for 
Did you mean: 

How to create xml nodes based on a value

pi_consultant1
Participant
0 Kudos

Dear friends,

I've a question about graphical mapping in SAP PI...

How can I create XML nodes on the target side based on a value in a XML field on the source side.

For example:

This XML field on the source:

<NO_OF_LINES>4</NO_OF_LINES>

Must result on 4 Lines on the Target:

<LINE></LINES>

<LINE></LINES>

<LINE></LINES>

<LINE></LINES>

So it's actually the opposite of the Count function...

I appreciate your help,

Thank you in Advance,

Kind regards,

John

Accepted Solutions (1)

Accepted Solutions (1)

former_member182455
Active Contributor
0 Kudos

Hi,

you can count and split the node using below udf.

for (int i=0;i<var1[0];i++)

result.addValue("");

Regards

Former Member
0 Kudos

Hi ,

Try this

NO_OF_LINES---> count---> UDF---> LINE


example :





UDF Code :


for (int i=0;i<var1[0];i++)

result.addValue("");

allamudi_loordh
Active Participant
0 Kudos

Hi sarkar,

i guess count is no need.

it should be like this.

NO_OF_LINES--->  UDF---> LINE


and LINE field should be 0..unbound.


use the above code. define var1 as integer.


regards,

Loordh.

pi_consultant1
Participant
0 Kudos

Thank you all for your help. This helped my problem.

I really appreciate it.

Kind regards,

John

Answers (1)

Answers (1)

former_member192851
Active Participant
0 Kudos

Use UDF.

This can help