IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
Expand all | Collapse all

LOOKUP Issue

  • 1.  LOOKUP Issue

    Posted 11/16/07 07:26 AM

    Originally posted by: SystemAdmin


    Hi,

    Please have a look at the following requirement:

    If Party.PartyInfo.PartyVendor.OrganizationInfo.AddressInfo.Street
    with type = "PO Box address" Exists
    Map it to Party.PartyInfo.PartyVendor.OrganizationInfo.AddressInfo.Street with address type
    = "PO Box address"
    ELSE from Party.PartyInfo.PartyVendor.OrganizationInfo.AddressInfo.Street with address type
    = "Street Address"
    For this I have coded the follwing way,

    =IF(LOOKUP(Value.Street.AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party,
    type .AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party="PO Box Address"
    )!=NONE,

    LOOKUP(Value.Street.AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party,
    type .AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party="PO Box Address"
    ),

    LOOKUP( Value.Street.AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party,
    type .AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party="Street Address"
    )
    )
    Now in the input file I have two segments of AddressInfo with the types as "PO Box Address" and "Street Address" each.
    The o/p I get is depending on the order of the segments and not on the logic I have provided.
    Please suggest me a way to achieve this. Thanks in advance
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 2.  Re: LOOKUP Issue

    Posted 11/16/07 09:30 AM

    Originally posted by: LaurentB


    Hi,

    the issue you encounter is called "data binding". I let our gurus explain this more in detail if they will, I'm not very comfortable explaining it in English.

    The first remark I'd have on your code is that, rather than testing a LOOKUP for presence to decide whether doing one LOOKUP or the other, a more straightforward way would be to use EITHER. EITHER will return it's first argument that is not equal to NONE, so you'd code :

    EITHER (LOOKUP(Value.Street.AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party,
    type .AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party="PO Box Address"),
    LOOKUP( Value.Street.AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party,
    type .AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party="Street Address"))

    This may release the data binding, and in this case your code will work as expected. If this is not the case, then you should try duplicating the "Party" card, to do the first LOOKUP on the first instance, and the second LOOKUP on the copy.

    Hope it helps
    Laurent
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: LOOKUP Issue

    Posted 11/16/07 10:04 AM

    Originally posted by: SystemAdmin


    the issue you encounter is called "data binding".
    I'm not all that comfortable explaining it also, and I've had to resloved it so many times years ago, I just don't code like that anyomre, and I can't recall what happens in the situation. There is some info in the Functions And Expressions guide if you do a search for bind.
    Anyway, overall, when you reference an object in an expression in a map rule, it binds that object to that expression, and if you try to use that object again, you don't get the results you expect.

    What Laurent mentions is one way to get around it, and it's probably how I would handle it.

    F_map( Value.Street.AddressInfo.OrganizationInfo.etc, Value.Street.AddressInfo.OrganizationInfo.etc)

    Then in the F_map you have two instances, one lookup on one card, the second lookup on the other card.
    What I used to to was,

    IF(NOT(PRESENT(LOOKUP(Value.Street.AddressInfo.OrganizationInfo, type .AddressInfo.OrganizationInfo="PO BOX")), then do this
    else,

    f_map2(Value.Street.AddressInfo.OrganizationInfo, type .AddressInfo.OrganizationInfo)

    and in the second funtional map,

    IF(NOT(PRESENT(LOOKUP(Value.Street.AddressInfo.OrganizationInfo, type .AddressInfo.OrganizationInfo="street address"),

    do this, else
    f_map3(Value.Street.AddressInfo.OrganizationInfo, type .AddressInfo.OrganizationInfo)

    Notice the "NOT(PRESENT" as opposed to "!=none".
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 4.  Re: LOOKUP Issue

    Posted 11/16/07 11:44 PM

    Originally posted by: SystemAdmin


    thanks for your reply Laurent...
    I had tried using EITHER before posting the query.
    It was not giving me expected results. Anyhow I will try to implement the second solution you've offered and get back to you with the result.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 5.  Re: LOOKUP Issue

    Posted 11/17/07 10:38 AM

    Originally posted by: jvanboga


    While there are various situations that cause data binding this really doesn't sound like a data binding issue. Usually that occurs with lookups in lookups. Not when each lookup is handled individually.

    Can you give us an example of a situation that works and one that fails? What do you mean that that you don't get the results you expect? What happens when neither conditions are 100% match?
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 6.  Re: LOOKUP Issue

    Posted 11/19/07 11:48 PM

    Originally posted by: SystemAdmin


    If you see the code, my intention is to find if the AddressInfo of type "PO Box Address" is present, if it is there it should return that. Else it should return the AddressInfo of type "Street Address".

    But what is happening is the code is returning the first the AddressInfo field which is occuring first in the input file. i.e. if AddressInfo of type "Street Address" is present first, it is returned If it is of type "PO Box Address" that is returned
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 7.  Re: LOOKUP Issue

    Posted 11/20/07 09:21 AM

    Originally posted by: jvanboga


    OK, this is a style thing but in the example above I see a bit of negative logic. Because of how my mind works I find it harder to work with when there are problems. I know that's weird but....

    Couple of suggestions for you.

    1st: if you have access to 8.n use the debugger and see what's actually happening in that rule.

    2nd: try testing this... (ugly and don't recommend it in prod but it might help you here)

    f_map(either(LOOKUP(Value.Street.AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party,
    type .AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party="PO Box Address"
    ),"No PO"),either(LOOKUP( Value.Street.AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party,
    type .AddressInfo.OrganizationInfo.PartyVendor.PartyInfo.Party="Street Address"
    ), "No Addr"), static_value_that_of_specific_issue_to_review)

    Then in your f_map write a rule based on the results of your input card. I might even fail the map with the results of in1 and in2 embeded and look at what I have. My bet is that while you think you have a PO box match you don't.

    Message was edited by: jvanboga
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 8.  Re: LOOKUP Issue

    Posted 11/20/07 09:26 AM

    Originally posted by: SystemAdmin


    If all else fails, the problem could be in the data and not the map rule.

    You have to mess around with it. Use the suggestions here, try some other logic there, manipulate the data, until you fully understand what's going on.

    Message was edited by: rep
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 9.  Re: LOOKUP Issue

    Posted 11/16/07 02:26 PM

    Originally posted by: jvanboga


    How about

    If(present( x), lookup(x), lookup(y))

    Message was edited by: jvanboga
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 10.  Re: LOOKUP Issue

    Posted 11/20/07 02:45 AM

    Originally posted by: LaurentB


    Hi,

    Did you try dplicating the input card used to feed the LOOKUPs, as I suggested ?
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 11.  Re: LOOKUP Issue

    Posted 11/21/07 03:19 AM

    Originally posted by: SystemAdmin


    yes Laurent,
    by duplicating the card I am able to get correct results. Thanks for helping me out...
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 12.  Re: LOOKUP Issue

    Posted 11/21/07 04:53 AM

    Originally posted by: LaurentB


    Great ! so this definitely was a data binding problem.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange