Skip to Content
author's profile photo
Former Member

Mapping Issue

Hello Guys,

I have a mapping issue. Well actually I need to be confirmed if what I am thinking is correct.

I have the following structure:

Source:

Orderheader (1..1)

-OrderParty (1..1)

--ShipToParty (0..1)

---Party (1..1)

-


ReceivingContact (0..1)

-


ListOfContactNumber (0..1)

-


ContactNumber (1.. unbounded)

-


ContactNumberValue (1..1)

-


ContactNumberTypeCoded (1..1)

Target:

Header (1..1)

--ShipTo (0..1)

---Telf1 (0..1)

I cannot change any structure (I can use node functions, I know) and need to map from the source ContactNumberValue where ContactNumberTypeCoded='TelNr' to

the target Telf1.

So I created the following mapping:

IF ContactNumberTypeCoded='TelNr' THEN map ContactNumberValue to Telf1

The ContactNumberTypeCoded has got the following values in the queque:

Email

FaxNumber

TelNr

The end result in the queue for Telf1 is the Email address.

So I started wondering why and to my opnion it has got to do something about the nodes, if we go back to the node:

ContactNumber where the 2 fields, ContactNumberValue and ContactNumberTypeCoded are in, has got an occurences of 1 to unbounded and the target only has 0..1 So thats the problem, the target can only receive one value and just takes the first one.

If that's correct then I have another question, why did the map didn't work correctly? Because I say in the mapping look for the right value en give me back that value and map it.

When I change the context for ContactNumberValue, ContactNumberTypeCoded to ListOfContactNumber which occurs (0..1) then it works fine. Is that because of the difference of occurences between source and target?

Best regards,

Guido

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on Sep 27, 2007 at 08:21 AM

    Hi,

    This seems to be a problem with contexts only. I can clearly tell you after goin thro' the payload.

    Can you paste your input payload here.

    Regards,

    Shri

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      This is the complete

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

      <Order>

      <OrderHeader>

      <OrderParty>

      <ShipToParty>

      <Party>

      <PartyID>

      <Identifier>

      <Agency>

      <AgencyCoded>AssignedByBuyerOrBuyersAgent</AgencyCoded>

      </Agency>

      <Ident>DEB7</Ident>

      </Identifier>

      </PartyID>

      <NameAddress>

      <Name1>Name 1 ShipTo</Name1>

      <Name2>Name 2 ShipTo</Name2>

      <Name3>Name 3 ShipTo</Name3>

      <Street>Street ShipTo</Street>

      <PostalCode>Postalcode ShipTo</PostalCode>

      <City>City ShipTo</City>

      <County>N/A</County>

      <Region>

      <RegionCoded>Other</RegionCoded>

      </Region>

      <Country>

      <CountryCoded>DE</CountryCoded>

      </Country>

      <ReceivingContact>

      <Contact>

      <ContactID>

      <Identifier>

      <Agency>

      <AgencyCoded>Other</AgencyCoded>

      <AgencyCodedOther>N/A</AgencyCodedOther>

      </Agency>

      <Ident>N/A</Ident>

      </Identifier>

      </ContactID>

      <ContactName>Guido K</ContactName>

      <ListOfContactNumber>

      <ContactNumber>

      foo@foobar.com

      <ContactNumberTypeCoded>EmailAddress</ContactNumberTypeCoded>

      </ContactNumber>

      <ContactNumber>

      <ContactNumberValue>0123</ContactNumberValue>

      <ContactNumberTypeCoded>FaxNumber</ContactNumberTypeCoded>

      </ContactNumber>

      <ContactNumber>

      <ContactNumberValue>00 11 333333</ContactNumberValue>

      <ContactNumberTypeCoded>TelephoneNumber</ContactNumberTypeCoded>

      </ContactNumber>

      </ListOfContactNumber>

      </Contact>

      </ReceivingContact>

      </Party>

      </ShipToParty>

      </OrderParty>

      </OrderHeader>

      <OrderDetail>

      <snip>

      </OrderDetail>

      <OrderSummary>

      <TotalAmount>

      <MonetaryValue>

      <MonetaryAmount>255.4</MonetaryAmount>

      <Currency>

      <CurrencyCoded>EUR</CurrencyCoded>

      </Currency>

      </MonetaryValue>

      </TotalAmount>

      </OrderSummary>

      </Order>

      Message was edited by:

      G. Koopmann

      Message was edited by:

      G. Koopmann

  • Posted on Sep 27, 2007 at 10:26 AM

    Hi

    If have understood your query correctly,

    I dont think its because of the difference of occurence value between source and target fieid.

    In your first mapping definition,

    <i>IF ContactNumberTypeCoded='TelNr' THEN map ContactNumberValue to Telf1

    The ContactNumberTypeCoded has got the following values in the queque:

    Email

    FaxNumber

    TelNr</i>

    Each element 'Email' , 'FaxNumber' and 'TelNr' have a context change in between. So the result queue of if function is suppress, cc, suppress,cc, telnr.

    So only the first context is considered. So i think the telnr node should not be generated at all in the target, since its not mandatory. I dont know why you got that node in the target.

    In the second case, after you removed the contexts, the result queue will be suppress, suppress, telnr. All in a single context. So all of these values are considered and the third element telnr is mapped to the target field. Hence you got the correct output.

    Add comment
    10|10000 characters needed characters exceeded

    • Koopmann,

      As per your example I'm <b>assuming</b> that you will have only three type of contacts also Telephone number will be the third contact. If my assumption is wrong then let me know.

      <ListOfContactNumber>

      <ContactNumber>

      foo@foobar.com

      <ContactNumberTypeCoded>EmailAddress</ContactNumberTypeCoded>

      </ContactNumber>

      <ContactNumber>

      <ContactNumberValue>0123</ContactNumberValue>

      <ContactNumberTypeCoded>FaxNumber</ContactNumberTypeCoded>

      </ContactNumber>

      <ContactNumber>

      <ContactNumberValue>00 11 333333</ContactNumberValue>

      <ContactNumberTypeCoded>TelephoneNumber</ContactNumberTypeCoded>

      </ContactNumber>

      </ListOfContactNumber>

      Try this:

      ContactNumberValue ->RemoveContext ->CopyValue[3]----->target.

      If the above logic doesn't helps then reply back.

      raj.

  • author's profile photo
    Former Member
    Posted on Sep 27, 2007 at 09:11 PM

    Hi,

    <i>When I change the context for ContactNumberValue, ContactNumberTypeCoded to ListOfContactNumber which occurs (0..1) then it works fine. Is that because of the difference of occurences between source and target?</i>

    Because in input file it is coming multiple times and out of them one of the value is TelNr.

    Hi Raj,

    May be 3rd position is not always telephone number. It could come any sequence.

    Thanks

    Shubhankar

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 08:17 AM

    Hi,

    As I have understood your problem:

    You need to map ContactNumerValue from source to Telfr in target structure, only when ContactNumberTypeCoded in source has Value 'TelNr'.

    You could perform following mapping for this:

    ContactNumberTypeCoded(Context changed to ListOfContactNumber) equals TelNr constant ............... if

    ContactNumberValue(Context ListOfContactNumber) .... Then -> Trim funtion -> RemoveContext -> SplitByValue -> Target TelFr

    In given example, it should work as follows:

    ContactNumberTypeCoded would have a queue with only one context without any Context Changes as follows:

    EmailAddress

    FaxNumber

    TelephoneNumber

    ContactNumberValue would have queue as follows originally:

    foo@foobar.com

    0123

    00 11 333333

    If condition would be successful only for TelephoneNumber and on output side you should receive only the telephone number.

    00 11 333333

    If there are any suppressed values, they would be removed by Trim function.

    Try this and let me know if it works.

    Thanks,

    Bhavish

    • Award points if comments are useful 😊

    Add comment
    10|10000 characters needed characters exceeded