cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Problem

markbernabe
Active Participant
0 Kudos

Hi Experts,

Need help in message mapping.

Here's the source


<MT_Source>

  <Name>Messi</Name>

  <Country>AU</Country>

  <Country>US</Country>

  <Country>MY</Country>

</MT_Source>

And expected target


<MT_Target>

  <Name>Juan</Name>

  <Status>OK</Status>

</MT_Target>

Country is 0-Unbounded. Status is based on the Country. If US exists, then Status is OK. Otherwise, NOT OK.

Example of NOT OK


<MT_Source>

  <Name>Neymar</Name>

  <Country>FR</Country>

  <Country>AU</Country>

  <Country>MY</Country>

</MT_Source>

Target


<MT_Target>

<Name>Neymar</Name>

  <Status>NOT OK</Status>

</MT_Target>

Is this possible with any built in function? Or just UDF?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Harish
Active Contributor
0 Kudos

Hi Mark,

It is possible with standard function.

Status --> map with default (blank) --> Equals "US" --> If without else map Status to target

regards,

Harish

markbernabe
Active Participant
0 Kudos

Thanks Harish. It was close but I couldn't get "NOT OK" status if I use IfWithoutElse. In case I use If, then I always get "NOT OK".

Harish
Active Contributor
0 Kudos

Change the map like below

Status --> map with default (blank) --> Equals "US" --> If

                                                                                              ---> then OK

                                                                                               ----> else "NOT OK"

regards,

Harish

markbernabe
Active Participant
0 Kudos

Hi Harish,

I've done that and I always get NOT OK because it satisfies the !=US condition even if the US exists.

Harish
Active Contributor
0 Kudos

Hi Mark,

you need to use the function equals from Text function. i think that is wrong here.

Please provide the display queue sceenshot at if function to give more inputs.

regards,

Harish

markbernabe
Active Participant
0 Kudos

Hi Harish,

I'm already using the equalsS function from Text.

Display queue of the Target field

Harish
Active Contributor
0 Kudos

Please use Split by value at the end.

regards,

Harish

markbernabe
Active Participant
0 Kudos

Hi Harish, I've added it but still getting NOT OK all the time.

Harish
Active Contributor
0 Kudos

Hi Mark,

what is the mapping of parent node of field STATUS. Can you please provide the screenshot and display queue?

regards,

Harish

markbernabe
Active Participant
0 Kudos

Hi Harish, You mean the parent of COUNTRY which is DETAILS? Then it's not mapped to any field.

Harish
Active Contributor
0 Kudos

Hi Mark,

I mean parent of target field STATUS. the problem can only be in field status.

regards,

Harish

markbernabe
Active Participant
0 Kudos

Hi Harish, MT_Source is mapped to MT_Target.

markbernabe
Active Participant
0 Kudos

Hi Harish,

I think I've fixed it now. I've added exists and IfElse function.

I'm able to use UDF as well.

Thanks a lot!

Harish
Active Contributor
0 Kudos

Hi Mark,

The mapping of field status is right. you can see in target queue also value US is getting populated. i think the problem should be with split by value. or mapping of header segment.

So please what the xml after transformation and check the splilt by value function again.

regards,

Harish

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Mark,

Your question is not clear, can you provide more details.

Thanks

markbernabe
Active Participant
0 Kudos

Hi Muneesh,

Not sure why the sample XMLs didn't show up. Hope this one shows up now

Source:

<MT_Source>

     <Name>Messi</Name>

     <Details>

          <Country>ID</Country

          <Country>TH</Country>

          <Country>US</Country>

          <Country>DE</Country>

     <Details>

</MT_Source>

Target:

<MT_Target>

     <Name>Messi</Name>

     <Status>OK</Status>

<MT_Target>

Status = OK if US country exists among the list of <Country>. Else, Status = NOT OK.