Get Free Trial
Get Free Trial

sorting row values issues of specific column

Answered
vasu asked on October 31, 2019

rows: [
{
uniqueName:”[Dim GL Codes Groups].[GL Category]”,
filter: {
members: [
“[Dim GL Codes Groups].[GL Category].[All].UNKNOWNMEMBER”
],
negation:true
},
sort:”desc”
},
],
I have arrange row values in sorted order
Example row values::
sortOrder: [“REVENUE”, “EXPENSES”,”MANAGEMENT FEE”,”VALET OPERATING EXPENSES”],
 

Please suggest us exact approach to sort 
Expected oreder is: [“REVENUE”, “EXPENSES”,”MANAGEMENT FEE”,”VALET OPERATING EXPENSES”],
 

Attachments:
orderflex.PNG

3 answers

Public
Vera Didenko Flexmonster November 1, 2019

Hello, 
 
Thank you for reaching out to us.
 
We would like to explain that the sortOrder option is supported only for OCSV, CSV, and JSON data source types.
 
For your case, we kindly suggest defining your own sorting method: https://www.flexmonster.com/doc/custom-sorting/
 
With such an approach you can cover a wider range of use cases.
 
Please let us know if this helps.
 
Best Regards,
Vera

Public
vasu November 4, 2019

is there any possibility to sort data form SSAS data source?

Public
Vera Didenko Flexmonster November 4, 2019

Hello,
 
Thank you for your question.
 
Yes, it is possible to sort data using the sortingMethod() API call.
Here is a JSFiddle example for illustration: https://jsfiddle.net/flexmonster/5Lfcpabw/
 
Please notice that the sort property is not specified for the field:

"slice": {
"rows": [
{
"uniqueName": "[Product].[Category]"
}
]
...
}

 
The desired order is set via the sortingMethod() API call:

//Specify the desired order
var sortOrder = [
"Bikes",
"Clothing",
"Accessories",
"Components"
];

pivot.sortingMethod("[Product].[Category]", function (a, b) {
return sortOrder.indexOf(a)-sortOrder.indexOf(b);
});

 
Please let us know if this works for you.
 
You are welcome to contact us in case of questions.
 
Best Regards,
Vera

Please login or Register to Submit Answer