How to sort a list of documents?

What product/components do you use and which version/fix level are you on?

webMethods 10.5

Is your question related to the free trial, or to a production (customer) instance?

Production/customer

What are you trying to achieve? Please describe it in detail.

Hello,

I have the following documents list: listOfUAs it represents apartments per floor.
image

R/C represents apartments at ground level.
Cave represents apartments below the ground level.

The correct order to display those in the front end should be something like this:

Cave Direito (right)
Cave Esquerdo (Left)
1Âş Direito (right)
1Âş Esquerdo (Left)
2Âş Direito (right)
2Âş Esquerdo (Left)

Current Output in JSON format.
{
“statusCode”: “0”,
“statusMessage”: “Success”,
“results”: {“response”: {
“systemStatusCode”: “0”,
“systemStatusMessage”: “Success”,
“listOfUAs”: [
{
“UADescription”: “1º Direito”,
“UAID”: “3656061”
},
{
“UADescription”: “1º Esquerdo”,
“UAID”: “3655743”
},
{
“UADescription”: “2º Direito”,
“UAID”: “3655810”
},
{
“UADescription”: “2º Esquerdo”,
“UAID”: “3655262”
},
{
“UADescription”: “3º Direito”,
“UAID”: “3656223”
},
{
“UADescription”: “3º Esquerdo”,
“UAID”: “3655577”
},
{
“UADescription”: “R/C Direito”,
“UAID”: “3656390”
},
{
“UADescription”: “R/C Esquerdo”,
“UAID”: “3655809”
}
]
}}
}

There’s any built-in service that can help me to achieve this?
Thank you.

Do you get any error messages? Please provide a full error message screenshot and log file.

Have you installed all the latest fixes for the products and systems you are using?

Take a look at the pub.document:sortDocuments service. It sorts a list of Documents, like your listOfUAs. You’ll need a field to sort on. If the UAID field does not give the order you want, you will have to add a field.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.