cancel
Showing results for 
Search instead for 
Did you mean: 

Complex Mapping

Former Member
0 Kudos

Hi,

I have a file to proxy scenario where input data structure is like that -

Here, I have an UDF where I am segregating some comma separated value and mapping that to the Record field means if 10 Record comes to the source side then 10 Record field will be created to the target side ----> this thing is working fine.

Now, under this depending on some value what I am getting in the UDF, I have to create that much of  energy fields with different values in the Reference and Value field. But this portion is not working .

I am doing this using below given java code in the UDF -

int b = 1;

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

{

// this is creating record fields

String s=String.valueOf(i);

result.addValue(s);

midnightdate.addValue(midnightDate[i]);

// this should create energy field ; but not working

   for (int r=0;r<maxEnergyTypePlaceHolders;r++)

      {

          String sp=String.valueOf(r);

          energy.addValue(sp);

          energyreference.addValue(headerEnergyType[r]);

          energyvalue.addValue(energyValue[i][r]);

     }

// this is creating checksum

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

       {

           String st=String.valueOf(w);

           checksum.addValue(st);

           checksumreference.addValue(checkSumHeader);

           checksumvalue.addValue(checkSum[i]);

       }

}

This code is creating Record field properly;

Suppose, in the sender side I am getting 10 records ; then its creating 10 record fields in the target side properly.Suppose under each Record field I have to create 10 energy field but instead of creating 10 energy fields to the separate Record field ,its creating all under 1st Record field ony.

please suggest how to solve this.

thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

gagandeep_batra
Active Contributor
0 Kudos

Hi Apu,

Add Context change (ResultList.CC) after every energy fields.

regards

Gagan

Former Member
0 Kudos

Hi Gagan,

Thank you so much for your valuable input.

Could you please help me where to add in the code mentioned above in the original post as I am not that expert in Java coding.

Former Member
0 Kudos

Hi Gagan,

Now its working fine using the context change of result list.

thanks a lot.

Answers (1)

Answers (1)

ambrish_mishra
Active Contributor
0 Kudos

You can use standard node function splitByValue (each value) as well.

Ambrish

Former Member
0 Kudos

Hi Ambrish,

Thank you for your reply.

I need to create 10 energy fields in the first record and then in the 2nd record another 10.

When I am adding split by value in the mapping its creating one energy field into each Record .

Please find the mapping attached below -