cancel
Showing results for 
Search instead for 
Did you mean: 

How to Handle Logic

former_member229127
Participant
0 Kudos

Hi all,

please can you advice me how to handle the logic as my logic is

IDOC FIELD

OUTPUT FILE FIELD

            Logic

E1P0000- MASSG

MASSG

Check if latest record value of E1P0000-MASSN is ‘0I’ or ‘0H’ then pass value of E1P0000-MASSG else pass space.

so i have done these logic for these

For the Fix Value I used like these

Please reply how to use it ??? and any UDF for these please

Best regards,

Sandhya

Accepted Solutions (1)

Accepted Solutions (1)

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Sandhya,

Can you try the below mapping logic. I have used udf for this requirement.

udf code:

int a = massin.length;

int b = massg.length;

if(a==b)

{

   if((massin[a-1].equals("0l")) || (massin[a-1].equals("0H")))

        result.addValue(massg[b-1]);  

  else

        result.addValue(" ");

}

else

      result.addValue(" ");

Regards

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sandhya,

Why are you using collapse context? Have you tried removing it?

Regards,

Mark

former_member229127
Participant
0 Kudos

Hi mark thanks for replying!!!

actually in these the logic i need is


for example in the    -----> E1PITYP
                                   -- E1P000
                                   -- E1P000

                                   -- E1P000

For E1PITYP there are many E1P000 so i have to collect the data from last E1P000 so i have used  collapse context .

Please can you advice !!! or through udf

Best regards,

Sandhya

sahithi_moparthi
Contributor
0 Kudos

Hi,

use below logic:

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sandhya,

Okay, I got it. CollapseContext will only retain the first value of the context. If you want it to be the last value, you need to use a sorting logic say for example like this.

E1P000 -> index: 1..1 (reset when new context)--> sortByKey (descending)

E1P000 -----------------------------------------------------------> /

I prefer the collapse context be done outside the ifWithoutElse, the reason is that you might get wrong outputs because of incorrect contexts.

Regards,

Mark