cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping question

former_member611341
Participant
0 Kudos

I have a source with a node and sub node under it and mapped as follows :

Here for all the source fields I have chnaged the context  to 'Test_source_msg'.

But when Iam not getting results as expected.

I want 'tg_fld1' to have value 'A'.

If you see in the first instance I don't have subnode present, I can have cases where sub node can not be present entirely. I think this is causing the issue when I debug.

I'm not comfortable with Java, I want to do this with mapping instead on UDF.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Muniyappan
Active Contributor
0 Kudos

Hi,

no sure i got your question.

try below one if it works for you.

Pass some dummy value like"NA" when sub_src_fld is not coming.

create two udfs. udf is for tg_fld1. udf1 is for tg_fld2.

pass two values to udf.

src_fld-->var1

sub_src_fld-->var2

change the execution type as All values of Queue.

use below code for udfs.

code for UDF.

for(int i = 0; i<var1.length;i++)

 

{

     if(var1[i].equals("A"))

          {

                         if (var2[i].equals("NA"))

                                                            result.addValue("");

                         else

                                                            result.addValue(var2[i]);

          }

}

Code for UDF1

for(int i = 0; i<var1.length;i++)

 

          {

               if(var1[i].equals("Z"))

                    {

                                   if (var2[i].equals("NA"))

                                                                      result.addValue("");

                                   else

                                                                      result.addValue(var2[i]);

                    }

}

mapping test results.

Regards,

Muniyappan.

Answers (0)