cancel
Showing results for 
Search instead for 
Did you mean: 

UDF to generate childs by source key

javier_alcubilla
Contributor
0 Kudos

Hi gurus,

I need help with an UDF. I'm trying to create a target structure, i have been able to create the child nodes needed but i have problems generating the <data_grouped> segment. Let me show the structures :

Source structure

<root>

     <child>
          <key1>
          <key2>
          <key3>
          <data1>
          <data2>
          <data3>
     </child>

     <child>
          <key1>
          <key2>
          <key3>
          <data4>
          <data5>
          <data6>
     </child>

     <child>
          <key4>
          <key5>
          <key6>
          <data7>
          <data8>
          <data9>
     </child>

</root>


Target structure:

<root>

     <child>
          <key1>
          <key2>
          <key3>
          <data_grouped>
               <data1>
               <data2>
               <data3>
               <data4>
               <data5>
               <data6>
          </data_grouped>
     </child>

     <child>
          <key4>
          <key5>
          <key6>
          <data_grouped>
               <data7>
               <data8>
               <data9>
          </data_grouped>
</child>

</root>

if same key1/key2/key3 then append data to target gruped by key1/key2/key3

Could you give me some light please??

Kind regards

Accepted Solutions (1)

Accepted Solutions (1)

ambrish_mishra
Active Contributor
0 Kudos

Hi Javier,

Made a generic solution for your requirement.

here is the mapping screenshot:

Here is the mapping for key1...apply for key2,3

mapping for data_grouped

mapping for data1...apply same for data2,3

Here is the test data I used with result

Hope it helps!

Ambrish

ambrish_mishra
Active Contributor
0 Kudos

Last 2 screenshots are not coming:

here you go again:

mapping for data1...apply same for data2,3

Here is the test data I used with result

I hope it is clear and fits your requirement.

Ambrish

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi.

Data1,Data2... are the names of fields or are the values?

Regards