Get Free Trial

How to define order/sort for JSON data

Ashley Murphy asked on August 3, 2016

How can I define a specific order to display rows in? I a custom  order I want the rows to display in, which I was previously doing using the following method in the XML configuration.

<member>Display first</member>
<member>Second row</member>
<member>000 Display third</member>

We’ve since moved to the more efficient JSON configuration and can’t quite find how to replicate this feature …

6 answers

Iryna Kulchytska Iryna Kulchytska Flexmonster August 3, 2016

Hi Ash,
Here is a sample of how to set custom sorting for hierarchy members in JSON report:
In report object when you define rows/columns, please specify customSorting array for the hierarchy, as follows:

var report = {
  data: jsondata,
  viewType: "grid",
  rows: [{uniqueName: "Color", customSorting: ["green", "yellow", "red", "blue"]}],
  columns: [{uniqueName: "[Measures]"}],
  measures: [{uniqueName: "Price"}]

Please let me know if it works for you.
Kind regards,

Ashley Murphy August 10, 2016

That seems to be exactly what I need. I’m having one issue with it, it only seems to work if what you’re attempting to sort on is all lowercase characters.
Example of what I’m trying to do here:
Same Example of it working with only lowercase characters: 
Any help appreciated!

Dmytro Zvazhii Dmytro Zvazhii Flexmonster August 10, 2016

Hi Ash,
Thank you for reporting this issue. We have reproduced it on our side. The fix will be available in the next minor release version 2.219 ETA Aug15.
Best regards,

Ashley Murphy August 11, 2016


We have a release to do late next week using this feature, so please let me know if there will be any delays!


Iryna Kulchytska Iryna Kulchytska Flexmonster August 11, 2016

Hi Ash,
The fix will definitely be included into the next minor release 2.219 that will be available on Aug 15.
Kind regards,

Tanya Gryshko Tanya Gryshko Flexmonster December 7, 2016

Hello Ash and all Flexmonster users,
After the release of version 2.3, we would like to inform you that customSorting property was renamed to sortOrder. The structure of report was changed. JSON report objects of the previous version and XML reports are fully supported in terms of backward compatibility. It means you can open or set reports from the previous major version.
Please note, that all reports will be saved in new JSON structure. Find more details about new JSON structure in the documentation: Report Object.
Check the updated sample:

Please login or Register to Submit Answer