SoftwareAG webMethods EDI mapping question : How to map one record into Multiple records

340 Views Asked by At

I am trying to map one record into multiple records using webMethods Designer flow service. 1 row converted into several rows. Please help me to wire webethods flow service to map the following using LOOP,REPEAT, MAP, etc.

SourceRecord
DateFields TargetRecord
DT ( Record initiator )( 1 .. 1 ) DTM (Record initiator)( 1 .. many times) OrderDate DTM_01 SalesDate DTM_02 ExpireDate

Sample Input data ( element delimiter "," and segment terminator newline)

DT,20200914,20200916,20230913   <-- where DT is record initiator "," is element separator 
                                    and orderDate = 20200914
                                        SalesDate = 20200916
                                        ExpireDate = 20230913

Desired Output Data ( multiple rows)  ( DTM is record initiator element delimiter "*" and segment terminator newline)
DTM*002*20200914   <-- 002 is qualifier for OrderDate
DTM*007*20200916   <-- 007 is the qualifier for SalesDate
DTM*036*20230913   <-- 036 is the qulifier for ExpireDate
1

There are 1 best solutions below

2
On

There is not enough information. Do you have one string with one record of input data? Do you have a list of strings or a document list? Most likely the record comes from a flat file? Is the output a string list or document list?

Anyway, the simple solution to your question (assuming one record) is to tokenize (using pub.string:tokenize) the input string and map it to output object using indices concatenating it with preset qualifiers:

enter image description here enter image description here

Now you can build your string out of that string list using pub.string:makeString, using new line as separator (notice that cursor is on the second line): enter image description here