cancel
Showing results for 
Search instead for 
Did you mean: 

How to sort rows based on field value

0 Kudos

Dear  Experts,

How to sort rows based on field value.

regards

Abdul

Accepted Solutions (1)

Accepted Solutions (1)

former_member186851
Active Contributor

Hello Mohd,

Try sortby key function which is under node functions.

If you can give example can assist you more.

0 Kudos

thanks Raghu,

my scenario is in every row i have 5 fields.

Example:

Source

row : 1 to unbounded

field1

field2

field3

field4

field5

if value for field one is repeated (equal for 2 rows) then those 2 rows should come under one message at target and one message should be created for every value change in field1 at target.

hope this clarifies.

Regards

Mukheed

former_member186851
Active Contributor
0 Kudos

Mohd Try like Below

For Row Node

Field--->sort---->SplitByValue---->CollapseContexts-----Row

For Field Node


Field---->Sort------>SplitByvalue(For Value change)------->Field

former_member182412
Active Contributor
0 Kudos

Hi Mohd,

Try this mapping for root node of row and row node and field1 and field2 are direct mapping.

Test result

Remember this will only work if the same value occur immediately, if not this will not work you need to use sort function.

Regards,

Praveen.

former_member186851
Active Contributor
0 Kudos

Praveen I guess I told the same answer.

former_member182412
Active Contributor
0 Kudos

Hi Raghu,

Your row mapping and field1 mapping different, check again.

Regards,

Praveen.

former_member186851
Active Contributor
0 Kudos

Got it Praveen,

I believe the below should help him more

For Row Node

Field---Remove context--->sort---->SplitByValue---->CollapseContexts-----Row

For Field Node


Field--Remove context-->Sort------>SplitByvalue(For Value change)------->Field

0 Kudos

Thanks Praveen and Raghu,

my requirement is same values are not immediate hence we need to sort and corresponding values for

field2

field3

field4

field5

should be same as in source structure.

Regards

Mukheed

former_member186851
Active Contributor
0 Kudos

Hello Mohd,

Try as Mentioned ..Sorted the values..

For Row Node

Field---Remove context--->sort---->SplitByValue---->CollapseContexts-----Row

For Field Node


Field--Remove context-->Sort------>SplitByvalue(For Value change)------->Field

It should wrk.

0 Kudos

not working,

Former Member
0 Kudos

Field valueRows

This should work.

former_member186851
Active Contributor
0 Kudos

Hello Mohd,

Can you please post SAMple input and output XML.

former_member182412
Active Contributor
0 Kudos

Hi Mohd,

Use below mapping for Message and row and Field1:

All other fields:

Regards,

Praveen.

0 Kudos

Thanks praveen,

Its working......

former_member182412
Active Contributor
0 Kudos

Hi Mohd,

Glad to hear that problem is resolved, close the thread as per this

Regards,

Praveen.

Answers (1)

Answers (1)

asdasd_asdasd
Active Participant
0 Kudos

Using XSL mapping is the best option here.