cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How To Prevent Sort Ascending Order Of Dynamic Column Name in Services Output

MM_10159448
7-Bedrock

How To Prevent Sort Ascending Order Of Dynamic Column Name in Services Output

Hi Team,

I am facing this issue mentioned below:

I want to prevent sort ascending order .Please help on this and provide solution

Thingworx Version-V8.5.6

MM_10159448_0-1688038237886.png

 

 

8 REPLIES 8
PaiChung
22-Sapphire I
(To:MM_10159448)

If you are generating this in a service, then you can apply your desired sort in the service before setting it to result.

Hope that helps.

Hi PaiChung,

Thank you for your reply

Applying desired sort means,not understood clearly, can u please explain or share some code if you have as an examples?

Currently, I am not applying any sort in service, You can see in screenshot, Whatever , I am sending as an input sequence, same I want in infotable service output. without sort ascending order

Hello,

 

Can you provide some code snippets from your service to help us understand how you are building the infotable.  My assumption from your screen shot and using "Dynamic Columns"  is that you are creating the data shape for the info table on the fly either entirely or adding columns to an existing data shape using AddField or fieldDefinitions.

 

In either case column order is not guaranteed to be in add order by default.  If you want to guarantee columns are in a specific order you must specify the ordinal property when adding the column.  Please see the following support cases for examples: CS313173 CS388066 

 

Thanks,

Travis

Hi Team,

Thank you for providing to set ordinal property information.

Now, Service giving desired output when executing service manually from composer but when checked in runtime 'Developer Tools' not getting desired output

Pls check both screenshot 

Let me know any solution on it

 

Ordinal_Runtime_Developer Tools.PNGOrdinal_Manual Exec.PNG

nmutter
14-Alexandrite
(To:MM_10159448)

A json object does not account property order. (https://stackoverflow.com/a/16870531)

The "ordinal" property is a twx-specific metadata which twx toolings will consider. The "wanted" order you can see in developer tools response in "datashape" (your screenshot shows the "rows" of the response) 

nmutter_0-1688767546697.png

 

May I ask the use case why you rely on the order of the properties?

Because, Order of Input can be anything, ascending OR descending, the service should provide output whatever input order coming.

slangley
23-Emerald II
(To:MM_10159448)

Hi @MM_10159448.

 

Why are you concerned with the order displayed in Dev Tools if Composer is displaying in the desired order?  Dev Tools is strictly the response that is returned.  It may not present in the desired order determined by the ordinal.

 

Regards.

 

--Sharon

After applying ordinal logic, Service giving desired result based on input any sequence provided but same checked in runtime 'Devtools' preview tab,It is again converting to ascending order

This is the problem

Top Tags