Author |
Message
|
mk140589 |
Posted: Wed Oct 23, 2013 10:18 pm Post subject: Data mapping - grouping of records into one structure |
|
|
Novice
Joined: 17 Jun 2013 Posts: 20
|
Hi guys,
I'm creating a new transformation using the graphical data mapping.
In the incoming format I have the following records which relate to each other :
Code: |
04 - Goods
05 - Just under the 04-records with the wagon number where the good was loaded on
06 - Wagon technical details |
My outgoing structure is xml and the wagonsection looks as follows :
Code: |
<Wagon>
<Wagonnumber>
<Technical Details>
</Technical Details
<Goods>
<Good>
</Good>
</Goods>
</Wagon> |
So, I would like to group the 05 and 06 records based on the wagonnumber and then get the 04 record that was above the 05 record.
Because of the fact that a 05-record can occur multiple times for one 06-record, the logic needs to be as follows :
Code: |
Take the 06-record and get the wagon number
For each 05-record where the wagon number is equal to the 06 one
Get the previous 04-record
Create a Good-segment
|
Is this possible using the graphical data mapping?
If no, can I do this with just a Custom ESQL or Java and can you please give me a headstart?
Thanks very much,
Best regards,
Maarten |
|
Back to top |
|
 |
mqsiuser |
Posted: Thu Oct 24, 2013 4:32 am Post subject: Re: Data mapping - grouping of records into one structure |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
I do not think that you can do grouping with graphical mapping.
And especially I think that you can not do grouping in an efficient way with graphical mapping.
You should have a look at this and check if it can help with your scenario.
The example is a bit "generic" ("A", "B"), but comes from the same background (where trucks (instead of wagons) are loaded with goods). _________________ Just use REFERENCEs |
|
Back to top |
|
 |
mk140589 |
Posted: Thu Oct 24, 2013 4:35 am Post subject: |
|
|
Novice
Joined: 17 Jun 2013 Posts: 20
|
Thanks for the reply.
I solved it by modelling my DFDL differently.
Instead of creating separate records, I now have structures to do this grouping. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Oct 24, 2013 6:28 am Post subject: Re: Data mapping - grouping of records into one structure |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
mqsiuser wrote: |
I do not think that you can do grouping with graphical mapping. |
I'm reasonably sure it's possible to do.
But mk140589's solution of changing the DFDL model to include additional structural elements is the better choice. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Oct 24, 2013 6:42 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
@mqsiuser: We have discussed this before. The Mapper most certainly can do grouping, and can handle complex joins and selects.
But I agree with mqjeff - changing the DFDL model was the best approach. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
mk140589 |
Posted: Thu Oct 24, 2013 7:04 am Post subject: |
|
|
Novice
Joined: 17 Jun 2013 Posts: 20
|
I still needed to group the 06-record with the 04-record based on the 05-records which where under the 04-record.
My DFDL structure looked like this :
Code: |
Goods element
04-record
Goodsdescription
05-record
Wagonnumber 1
05-record
Wagonnumber 2
Wagon element
06-record
Wagonnumber 2
Wagon element
06-record
Wagonnumber 1
|
My mapping looks like :
Code: |
For each Wagon element (include the Goods element as supplementary connection)
For each Goods element (include the Wagonnumber as supplementary connection)
For each 05-record with the condition : 05-record/Wagonnumber = Wagonnumber
Fill in the Goods
End for
End for
End for |
I hope this helps people who face the same problem.
If you have any remarks or optimisations, please let me know.
Best regards,
Maarten |
|
Back to top |
|
 |
|