IBM Sterling Transformation Extender

Sterling Transformation Extender

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


#Sterling
#Supplychain
 View Only
  • 1.  Mapping multiple inputs to single output

    Posted 12/12/08 02:24 PM

    Originally posted by: SystemAdmin


    Hi All,
    I have a mapping requirement where, I get two inputs of type(s) needs to be mapped to single output of type(s). Since, there are multiple instace, I have to use function to map input to output.
    I am not sure, how I can input from two input source to one output.

    Any help is appreciated.

    Thanks in advance!!

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


  • 2.  Re: Mapping multiple inputs to single output

    Posted 12/12/08 03:52 PM

    Originally posted by: repanzer


    What version are you running?

    There used to be a tutorial that was part of 7.5, but as of 8.X and up, IBM removed it. I hate them for it also.

    Anyway, there is a chapter:
    Chapter 13 - Mapping Multiple Files to One File

    If you have access to the tutorial, I suggest you use it, for it is very helpful.
    Other then that, it depends on your circumstances.

    If you have two inputs, each with records that correspond to records in the other file, for example, the following files have matching "Purchase order numbers";

    File1
    REC1*DATETIME*PurchaseOrderNumber*Invoice_Number
    REC2*DATETIME*PurchaseOrderNumber*Invoice_Number
    REC3*DATETIME*PurchaseOrderNumber*Invoice_Number

    File2
    REC1*DATETIME*PurchaseOrderNumber*Billing_Number
    REC2*DATETIME*PurchaseOrderNumber*Billing_Number
    REC3*DATETIME*PurchaseOrderNumber*Billing_Number

    And in your output, you want this record;

    REC1*DATETIME*PurchaseOrderNumber*Billing_Number*Invoice_Number
    REC2*DATETIME*PurchaseOrderNumber*Billing_Number*Invoice_Number
    REC3*DATETIME*PurchaseOrderNumber*Billing_Number*Invoice_Number

    Buil
    d the map just like you would if there were one input, but your functional map would look like this;

    F_Map(Record:File1, EXTRACT(Record:File2, PurchaseOrderNumber:Record:File2= PurchaseOrderNumber:Record:File1))

    But if each record in each file should create a record in your output, for example, you have 3 records in the first input file and 3 records in the second input file, and you want 6 records in the output file, your functional map would look like this;

    F_Map(Record:File1, Record:File2)

    Hope that helps.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 3.  Re: Mapping multiple inputs to single output

    Posted 12/16/08 04:27 PM

    Originally posted by: SystemAdmin


    Thanks for the reply.

    My requirement was your second type,
    "But if each record in each file should create a record in your output, for example, you have 3 records in the first input file and 3 records in the second input file, and you want 6 records in the output file, your functional map would look like this;

    F_Map(Record:File1, Record:File2)
    "
    I am not sure, how this functional map will work. since, I will have two input card in the Function map and one output card. How we are going to map the elements from both cards in to one output card?

    Right now, we created an copy of the same type in TT and made it working. But, we are looking at achieving this logically, than changing the mtt

    We are using 8.1 and 8.2

    Thanks,
    -Mahesh
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 4.  Re: Mapping multiple inputs to single output

    Posted 12/16/08 05:54 PM

    Originally posted by: repanzer


    You probably have something like this;

    OutputFile
    OutputRecord (s)

    You could do something like this; 2 groups of the same output records, then just have a functional map for each input file type.

    OutputFile
    OutputRecord1(s) =F_map1(Records:INPUT1)
    OutputRecord2(s) =F_Map2(Records:Input2)

    If you were to go with what I had above:
    F_Map(Record:File1, Record:File2)

    What would happen is:

    The first functional map run would grab Record (1) :File1 and Record(1):File2

    Then;

    Record(2) :File1 and Record(1):File2

    Record(3) :File1 and Record(1):File2

    And if there were only 3 records in file one, the next run would be;

    Record(1) :File1 and Record(2):File2
    Record(1) :File1 and Record(3):File2
    Record(1) :File1 and Record(4):File2

    This may not help, but the above it should do it.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 5.  Re: Mapping multiple inputs to single output

    Posted 12/17/08 05:05 PM

    Originally posted by: SystemAdmin


    Yes, we ended up doing as u mentioned.

    OutputFile
    OutputRecord1(s) =F_map1(Records:INPUT1)
    OutputRecord2(s) =F_Map2(Records:Input2)

    Eventhough we don't like it, since, our mtt is based on the Schema and whenever there is a schema change, we will reimport it in to TT, which I would guess, will erase the change that we made only in TT. For now, we just made a note of it, so that developers don't forget later!!

    Thanks,
    -Mahesh
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 6.  Re: Mapping multiple inputs to single output

    Posted 12/18/08 02:31 PM
      |   view attached

    Originally posted by: repanzer


    The only other way I can possibly think of is to combine the two sets of input records before you map the output.

    Now with the two different record types in one file, have the records in the Type Tree as "partitioned". Are you familiar with partitioning? It means that the next sequential record could be either of two types (or more if you needed).

    Take a look at the attached picture partition_qm.JPG in the zip file.

    So now I have;

    File
    ...Partitioned Records Group (s)
    .....X record
    .........field1
    .........field2
    .....Y record
    .........field1
    The object passed in the f_map is Partitioned Records Group

    =F_MAPrec(PartRecordGroup:997In)

    In the map rules of the F_map, you can use the "EITHER" function, which says "use the first object that does not equate to NONE".

    Take a look at the other picture partition_fmap.JPG
    In the first field, if the current record is the X record, it will use the first field in the X record, but if it's the Y record, it will use the first field in the Y record.
    Now you can do this in two maps; the first which combines the two input files, then passes the output to the actual XML translation map, or, you can do it in one map.
    In order to do it in one map, you'll the two input files as input cards and two output cards.

    The first output card is the one that has a partitioned type tree and you map the two input cards into this one output card.

    Then, use that output as the input to the functinal map of the second output card which is your XML.

    Make sense?
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender

    Attachment(s)



  • 7.  Re: Mapping multiple inputs to single output

    Posted 12/18/08 02:58 PM

    Originally posted by: repanzer


    There is one other way you can do it is, if there is a way to identify each record. Let's say there are X records and Y record; the X records start with X, the Y records start with Y, both are comma delimited.

    X,field1,field2, field 3,
    Y,field1,field,field3,field4
    Rather then have an input type tree for each of the records, you have one record type and it is defined as a "blob" of text, with no distinction in what fields are in the record. So regardless of what record type the map is looking at, it passes validation. Combine the records into one file.

    So now you have a file of the two record types that both fit this definition;
    File
    ...Records (s)
    .....Blob

    Pass the records to the F_map.

    Let's say that the first field should be populated with the second field of the X record, or the third field of the Y record. Use the WORD function for this, which does "On the fly" delimiting.

    The rule for the first field would look like;
    IF( LEFT(blob,1)="X" //if the current record is an X record then

    WORD(blob,",",2) //use the data after the second comma

    , //else, it must be the Y record, so

    WORD(blob,",",3) //use the data after the third comma
    )
    Again, you can do this in one or two maps, following the same approach as stated above with the partitioning; either have two maps, one that combines and one that translated, or one map with two output cards, one that combines the two inputs, and the other that used the output of the first output card as input to the second output card (XML).
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 8.  Re: Mapping multiple inputs to single output

    Posted 12/31/08 11:47 PM

    Originally posted by: jvanboga


    Simplest way to do this is to have two output cards. Build your functional maps in output card 1 for input file 1. Set output file to create. Copy output card 1 to output card 2 change the details of output card two to append, change the input to the functional map in output card 2 to input 2. At this point you are done.

    input1
    to
    f_map_build_output_file(input1) {card setting = create on success}
    input2
    to
    f_map_build_output_file(input2) {card setting = append on success}
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender