cancel
Showing results for 
Search instead for 
Did you mean: 

Wierd Behaviour of IF then ELSE standard function

RameshGulipall
Active Participant
0 Kudos

Hi All,

I am facing a very wierd behaviour of the IF then ELSE function in a mapping.

Condition to be checked:   if GDS_id = 1, then (condition 1 -  RFC lookup ) ElSE (condition 2 - JDBC Lookup followed by an RFC  lookup).

Issue:  The input payload is 0-unbounded with a possibility of a different GDS_id values.

Case 1 :

As shown below, in case the input payload has 3 repitions of the RECORD, with the Fit set having GDS_ID = 01, the mapping runs perfectly fine . All the If then Else branches are getting executed.

Case 2:

Where as iF the first GDS_ID != 01 (not 01) , thenthe target value is not getting populated properly .

I have tried all the possibilities and combinations but i am unable to resolve this. Please help.

Attached the screen shot of the message mapping, and sample test results of both the use cases.

---------------------------------------------------------------------

For instance, below is a sample payload:

----------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<ns0:mt_EMERGO_common xmlns:ns0="http://sabreEMERGO_common.com">

<Record>

      <booking_date>08012013</booking_date>

      <iata_code>2325540</iata_code>

      <gds_id>01</gds_id>

      <pos_code>RD3A</pos_code>

      <gds_code>01</gds_code>

      <net_booking>11</net_booking>

   </Record>

<Record>

      <booking_date>08012013</booking_date>

      <iata_code>2325540</iata_code>

     <gds_id>02</gds_id>

      <pos_code>54S8 </pos_code>

      <gds_code>02</gds_code>

      <net_booking>11</net_booking>

</Record>

  </ns0:mt_EMERGO_common>

----------------------------------

Accepted Solutions (0)

Answers (5)

Answers (5)

RameshGulipall
Active Participant
0 Kudos

Hi All,

I have changed the message mapping like below. Even though i am not getting my target filed as value. As per my requirement if GDS_ID=01  then perform the RFC lookup and pass the value to target fields KUNNR and else GDS_ID=02 then perform the JDBC LOOKUP and JDBC LOOKUP output to RFClookup .RFC LOOKUP output pass to my target field KUNNR.

Result of my mapping is 1st record only populated KURNNR in Target side and 2nd record not showing as KUNNR filed in target side .But I have taken look on display queue in If then else out showing 2 values but it is not passing to target filed.

Please provide any suggestion to resolve this issue.

Please find the mapping logic:

Please find the test screen:

Please find the test Data:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:mt_EMERGO_common xmlns:ns0="http://sabreEMERGO_common.com">

   <Record>

      <booking_date>08012013</booking_date>

      <iata_code>2325540</iata_code>

     <gds_id>02</gds_id>

      <pos_code>54S8 </pos_code>

      <gds_code>AA</gds_code>

      <net_booking>11</net_booking>

   </Record>

   <Record>

      <booking_date>08012013</booking_date>

      <iata_code>2325540</iata_code>

      <gds_id>01</gds_id>

      <pos_code>RD3A</pos_code>

      <gds_code>AA</gds_code>

      <net_booking>11</net_booking>

   </Record>

</ns0:mt_EMERGO_common>

Regards,

Ramesh

ambrish_mishra
Active Contributor
0 Kudos

Ramesh,

the reason of KUNNR not getting populated is obvious.

if then else is behaving as it is supposed to....You have 2 values of gds_id with a context change while then and else construct just generates one value after remove context. it should have 2 values with a context change. the first value in case of gds_id 02 generates the value since it has values in then and else queue while for gds_id 01, there is no corresponding value to generate the output.

Please do as stated below:

If your RFC can take multiple values in a context and return a table, then pass POS_CODE(context Record) to the RFC and then do a split by value and pass to then construct.

follow a similar approach for the else construct.

Few questions:

<pos_code>54S8 </pos_code> and <pos_code>RD3A</pos_code>. what is the expected RFC look up output.

Also what is the output expected from JDBC look up and then subsequent output from RFC.

Once you have sorted these 2 questions, the mapping will give you desired output.

Ambrish

praveen_sutra
Active Contributor
0 Kudos

Hi Ramesh,

Please remove the highlighted removeContext.I hope this should solve the issue.

If it wont then please remove both splitByValue and RemoveContext(high-lighted)

thanks and regards,

Praveen T

RameshGulipall
Active Participant
0 Kudos

Hi Ambrish/Praveen,

Thanks for your reply!!

I have changed the message mapping according suggested by you, now it is working with if 1st record is GDS_ID=02 and 2nd Record is GDS_ID=01 .Mapping successfully processed to generate the Target records with KUNNR. But if I tested with 1st record is GDS_ID=01 and 2nd Record is GDS_ID=02 then Mapping not processed successfully generate the Target 2nd records with KUNNR.

Please provide your suggestion to resolve this issue.

Please find the below screen mapping logic:

Please find the below successful test screen and test data.

Please find the below unsuccessful generated KUNNR record for the 2nd record.I checked the dispaly queues in If then esle display the ifout as two valuers but not transfored  to traget field KUNNR.Please suggessted me how to  reslove issue

Regards,

Ramesh

Message was edited by: Ramesh Gulipalli

ambrish_mishra
Active Contributor
0 Kudos

I am not sure why you are doing split by value and then remove context in the else part after RFC look up.

Please understand the concept that both then and else part should have similar (in your test case 2) outputs with context change and then corresponding value will pass on the target based on true or false.

should not be a hit and trial..

Ambrish

RameshGulipall
Active Participant
0 Kudos

HI Ambrish,

I have removed the Revove context  in else part then my dispaly queue is not not showing the IFOUT not showing the all the values .Please provide your inputs on this issues.

Former Member
0 Kudos

Hi Ramesh,

Use map with default after TDW_JDBC

Prasad Konda

praveen_sutra
Active Contributor
0 Kudos

hi Ramesh,

Could you please try two things

1)  use Ifelse instead of IfEsleS

2)  make if else condition before jdbc and rfc calls.

thanks and regards,

Praveen T

praveen_sutra
Active Contributor
0 Kudos

Hi Ramesh,

My suggestion would be use remove context in place of collapse context in your mapping.

If you still get problem please let us know.

thanks and regards,

Praveen T

RameshGulipall
Active Participant
0 Kudos

Hi All,

I have used the remove context in mapping but Still i am getting the same error.

Please find the test data below.

Please provide any suggestion on this issue.

Regards,
Ramesh

ambrish_mishra
Active Contributor
0 Kudos

Hi Ramesh,

I suggest you state your requirement rather. What is the target node and field mapping requirement.

Ambrish

praveen_sutra
Active Contributor
0 Kudos

Hi Ramesh,

there is no test data as mentioned in your message.

thanks and regards,

Praveen T

praveen_sutra
Active Contributor
0 Kudos

Hi Ramesh,

Please put remove context at mentioned nodes and post the screenshot of display queue of highlighted fields(Yellow bordered)

this will help us to analyse us further.

thanks and regards,

Praveen T

RameshGulipall
Active Participant
0 Kudos

HI Praveen,

Still i am facing the same issue.Please suggest me  and  find the below screen for dispaly queues.

Test data screen shot below.

If i gave the test data with 1st rrecord is GDs ID =01  and 2nd record is GDS ID=02 then mapping working successfully.Please find the below screen shoot.

Regards,

Ramesh

praveen_sutra
Active Contributor
0 Kudos

hi Ramesh,

there is no screenshot attached .

Please attach again.

thanks and regards,

Praveen T

RameshGulipall
Active Participant
0 Kudos

HI Praveen,

Still i am facing the same issue.Please suggest me  and  find the below screen for dispaly queues.

Test data screen shot below.

If i gave the test data with 1st record is GDs ID =01  and 2nd record is GDS ID=02 then mapping working successfully.Please find the below screen shoot.

praveen_sutra
Active Contributor
0 Kudos

hi Ramesh,

As per my understanding the the RFC lookup for true case is giving first null value hence during mapwithDefault the a blank node is generating. Now the question is why is the null value coming.If you will do a display queue on the pos_code you will notice both the values going as input (RD3A and 54S8). Hence in the RFC when RD3A is going its giving a null value. You can get it confirmed by doing a display queue at RFC.

Now my suggestion would be put a if(withoutelse) before first RFC lookup and pass only those pass_code which (gas_ID=01).

Hope this helps.

thanks and regards,

Praveen T

nipun_shedhani4
Explorer
0 Kudos

Hi Ramesh,

As spotted by Ambrish and  Aaron, I see the same thing that the Collapse context will collapse the complete queue value but top one and therefore you will run the if condition only once.

That is why you find values for first queue the second repetition of your source structure wont be checked as required.

Regards,

Nipun

Former Member
0 Kudos

Right click your If condition and show the output of your queue (Display Queue). Do this at different points along your mapping and pay close attention to the context as Ambrish suggests.For example, look at the light grey, dark grey, and blue colors and make sure they line up as you would expect. You can collapse the context to get it at the right level of your output.

ambrish_mishra
Active Contributor
0 Kudos

Hi Ramesh,

One potential issue I see is that in else branch, I don't see a collapseContext while in if and then I see collapseContext is applied.

Is that an issue ?

Ambrish