cancel
Showing results for 
Search instead for 
Did you mean: 

How to Sort the Incoming File Contents Before Message Mapping

Former Member
0 Kudos

Hi,

I have requirement like i have to sort the file contents before message mapping in a Order. Is there any option please suggest me . Any inputs will be helpful.

Source structure is like this

<order_row> 1-1

<Header> 1-1

field1

....

</Header>

<Merchandise> 1- unbounded

filed1

....

</Merchandise>

<LineNote> 1- unbounded

field1

....

</LineNote>

</order_row>

Thanks & Regards,

Tanuja

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

What you can also do is add another mapping step that only does the sorting and then add the mapping that you already have(the one that expects the sorted input)

Horia

Answers (5)

Answers (5)

Former Member
0 Kudos

I tried two mappings Technique. Problem is solved

Thank u all

rajasekhar_reddy14
Active Contributor
0 Kudos

Sorting messages before message mapping not possible, in file channel you can pickup file time creation order.

Using message mapping can achieved easily.

Former Member
0 Kudos

Hi All,

Thank you all.

I already designed all the coditions in the mapping. So i think it will be better to go with two mapping steps.

I need to sort only nodes.

Please let me know how can i acheive that in first mapping.

Thanks & Regards,

Tanuja

former_member184681
Active Contributor
0 Kudos

Use XSLT mapping for this purpose. See an example here in w3schools:

http://www.w3schools.com/xsl/xsl_sort.asp

In the example, nodes are sorted by the "artist" node value.

Hope you'll find it useful,

Greg

Former Member
0 Kudos

Hi, i suggest using XSLT mapping where you can sort with xsl:for-each and xsl:sort command. Compared to message mapping there is no need to sort each and every field, only the parent node has to be sorted.

Martin

former_member184681
Active Contributor
0 Kudos

The problem is that in some cases creating the whole mapping as XSLT is much more difficult comparing to graphical mapping, or even impossible in some particular cases. I think the decision here is rather between two step mapping (one for sorting and another one for the actual mapping) and sortByKey function, and it actually depends on some important factors. The first one should be easier to prepare, especially for complex structures, but might be worse in terms of processing performance. On the other hand, the latter solution is quite difficult to develop initially, but I think will be less error-prone and noticeably better in terms of performance.

Hope you'll find it useful,

Greg

Former Member
0 Kudos

I agree that 2 mapping steps are a good approach. The first for sorting with XSL and the second message mapping.

former_member184681
Active Contributor
0 Kudos

Hi,

You can use the sort or sortByKey functions from Node Functions in your graphical mapping. Unfortunately you will have to use this function in the mapping for each relevant field - there is no option for pre-sorting whole XML structure, as far as I know. Alternatively, you might consider using ABAP mapping.

Hope you find it useful,

Greg