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

Using Extract on Choice Group

  • 1.  Using Extract on Choice Group

    Posted 12/12/11 12:18 PM

    Originally posted by: JRules


    Hello experts,

    I am having trouble extracting a series of REF segments which are defined as choice groups in my type tree. Here is the snippet of code that I using to get it to work.

    
    F_TEST(EXTRACT(Member_Id REF Choice_Group:Member REFs Unordered_Group:In_Member,Ref#Qual
    'r Element:REF_ZZ_Mutually_Defined REF Segment:Member_Id REF Choice_Group:Member REFs Unordered_Group:In_Member="ZZ"))
    


    What I am looking for is to extract only those REF segments that have a REF01 of ZZ.

    Since I can't attach more than one attachment, I have pasted sample data below and have attached a snapshot of the input card type tree. Thanks in advance.

    Sample Data
    ***********
    
    ISA*00*          *00*          *ZZ*MIL086630D     *ZZ*G00621   *100708*2250*^*00501*201007081*1*T*: GS*BE*086630*G00621*20100708*2250*201007081*X*005010X220A1 ST*834*100708005*005010X220A1 BGN*00*100708005*20100708*2254****4 DTP*007*D8*20110909 N1*P5*NMPSIA*FI*850365637 N1*IN*CORP*FI*3 INS*Y*18*030*XN*A***TE REF*0F*632071289 REF*1L*123456789 REF*ZZ*RDLN REF*ZZ*N REF*ZZ*E REF*DX*MAKO!Y!FSM REF*ZZ*S SE*19*100708005 GE*1*201007081 IEA*1*201007081
    

    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 2.  Re: Using Extract on Choice Group

    Posted 12/12/11 12:25 PM

    Originally posted by: NancyR


    The problem is your EXTRACT is only extracting from the REF_ZZ_Mutually_Defined REF segment.

    This should work:

    F_TEST(EXTRACT(Member_Id REF Choice_Group:Member REFs Unordered_Group:In_Member,Ref#Qual'r Element IN Member_Id REF Choice_Group:Member REFs Unordered_Group:In_Member="ZZ"))
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 3.  Re: Using Extract on Choice Group

    Posted 12/12/11 01:12 PM

    Originally posted by: JRules


    Nancy,

    Thanks for your response. I tried your code but it is only extracting the first occurrence of the REF segment (matching ZZ). I should be able to extract all of the matching ones :)
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 4.  Re: Using Extract on Choice Group

    Posted 12/12/11 01:27 PM

    Originally posted by: NancyR


    Could you post your map, type tree(s) and input file(s)?
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 5.  Re: Using Extract on Choice Group

    Posted 12/12/11 02:58 PM
      |   view attached

    Originally posted by: JRules


    Here you go...

    In order for the map to run, do the following:

    >> Under the 'Data' folder, open the "misc.txt" file, replace "F:\Work\WTX\DeleteMe\Data" with the path where the map files are extracted to.

    The output file will be created in the "..\\Data\archive" folder with a".POST' extension
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange

    Attachment(s)



  • 6.  Re: Using Extract on Choice Group

    Posted 12/12/11 03:50 PM

    Originally posted by: JRules


    Oh, and the output rule is to be written on
    
    R932_CHR_2 Group[1]:R932_MEMBER_RECORD Record:Out_Member
    
    of F_Member function.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 7.  Re: Using Extract on Choice Group

    Posted 12/12/11 04:44 PM

    Originally posted by: NancyR


    I think I made this unnecessarily complicated.

    F_TEST( EXTRACT( REF_ZZ_Mutually_Defined REF Segment:Member_Id REF Choice_Group:Member REFs Unordered_Group:Member_Level INS Loop:Transaction #834 Inbound Partner Set V5010X220A1:#834F5010X220A1Inbound Partner Funct'lGroup ANSI:Partner X12 Inbound Interchange:In_X12_834, Ref#Qual'r Element IN Member REFs Unordered_Group:Member_Level INS Loop:Transaction #834 Inbound Partner Set V5010X220A1:#834F5010X220A1Inbound Partner Funct'lGroup ANSI:Partner X12 Inbound Interchange:In_X12_834 = "ZZ" )))
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 8.  Re: Using Extract on Choice Group

    Posted 12/12/11 05:17 PM

    Originally posted by: JRules


    Nancy - I am still getting only ONE REF segment out of this code. Are you getting a set of REF segments (matching ZZ) or is just one REF?
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 9.  Re: Using Extract on Choice Group

    Posted 12/12/11 05:37 PM
      |   view attached

    Originally posted by: NancyR


    I created a small map and got multiple segments. It's called Map and is in the same .mms as your map.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender

    Attachment(s)



  • 10.  Re: Using Extract on Choice Group

    Posted 12/13/11 11:47 AM
      |   view attached

    Originally posted by: JRules


    Hello Nancy,

    Sorry to add on another question here but do you know if I can add a CHOOSE function on EXTRACT? Here is what I am doing: For reasons unknown to me, I am not getting any output out of this.

    
    =F_TEST(CHOOSE(EXTRACT(REF_ZZ_Mutually_Defined REF Segment:Member_Id REF Choice_Group:Member REFs Unordered_Group:In_Member,Ref#Qual
    'r Element IN Member REFs Unordered_Group:In_Member="ZZ"),3))
    


    Please see attached snapshot to get a better idea.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 11.  Re: Using Extract on Choice Group

    Posted 12/13/11 11:48 AM
      |   view attached

    Originally posted by: JRules


    Hello Nancy,

    Sorry to add on another question here but do you know if I can add a CHOOSE function on EXTRACT? Here is what I am doing: For reasons unknown to me, I am not getting any output out of this.

    
    =F_TEST(CHOOSE(EXTRACT(REF_ZZ_Mutually_Defined REF Segment:Member_Id REF Choice_Group:Member REFs Unordered_Group:In_Member,Ref#Qual
    'r Element IN Member REFs Unordered_Group:In_Member="ZZ"),3))
    


    Please see attached snapshot to get a better idea.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 12.  Re: Using Extract on Choice Group

    Posted 12/16/11 02:21 PM

    Originally posted by: jvanboga


    Should be able to use these rules

    F_TEST(REF_ZZ_Mutually_Defined REF Segment:Member_Id REF Choice_Group:Member REFs Unordered_Group:In_Member)

    or

    if(member(Ref#Qual'r Element Member REFs Unordered_Group:In_Member,{"ZZ"}),
    F_TEST(CHOOSE(EXTRACT(REF_ZZ_Mutually_Defined REF Segment:Member_Id REF Choice_Group:Member REFs Unordered_Group:In_Member))
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 13.  Re: Using Extract on Choice Group

    Posted 12/12/11 05:52 PM

    Originally posted by: JRules


    My apologies Nancy - Your code worked like a charm. It was a silly mistake on my part. I created an index on the group and was expecting the debugger to show the series. Yeah, stupid me! But thanks for your quick response!
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 14.  Re: Using Extract on Choice Group

    Posted 12/12/11 04:07 PM

    Originally posted by: repanzer1


    JRules, I'm curious....I've only worked on a couple X12 transactions in this version, but, there are choice groups in X12 5010?? Or did you customize an X12 tree to fit your mapping requirement?

    I'm working with SWIFT now and they have Choice Unordered and it is a bit tricky.
    There are 10 types of people in this world. Those who understand binary and those who don't.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 15.  Re: Using Extract on Choice Group

    Posted 12/12/11 04:17 PM

    Originally posted by: JRules


    repanzer - Yes. This is a customized type tree. I hate choice groups :) They are a true pain in the neck.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 16.  Re: Using Extract on Choice Group

    Posted 12/13/11 02:50 PM

    Originally posted by: JRules


    Thanks to Nancy for a quick and neat answer.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 17.  Re: Using Extract on Choice Group

    Posted 04/09/12 11:25 AM

    Originally posted by: SystemAdmin


    I Think you guys are extracting from the wrong REF Segment , Wat i mean is REF segment from a different group.

    Lobo
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 18.  Re: Using Extract on Choice Group

    Posted 12/04/13 09:38 AM

    Originally posted by: Puneet123


    Hi , i came across a similar issue discussed above is there a workaround for the description below

    Need a clarification on a issue i am facing, i have a group which has 3 REF groups and the third one being a choice group, i need to pick REF03 from all of them based on the Qualifier REF02 from the cross reference. Which is the best way to do so, the group structure below.

    Member Ref Unodered Group
      REF_OF Group
      REF_1L group
      MemberID REF CHoice Group(0:12)
        REF_17 Group
        REF_23 group
       .
       .
     

    The structure above is that, there is a Member REF group, which has three groups inside it, the first 2 are REF_0F and REF_1L abd the third one is a Member ID choice gruop, which can occur of 12 times and has 12 differen REFs inside it.

    I can not use a IN over here, as the third one is a choice group, as of now i have added two separate rule for 0F and 1L and one separate rule for the choice group.

    Is there a other way top do so, and why is that we can not use a IN for all the REF at once

     


    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender