Need a special offer?Find out if your project fits.
+

Sort on inactive dimensions

Answered
Jan Strohbehn asked on October 12, 2016

Hi,  

We offer our users pre-defined reports with inactive dimensions they can activate at their convenience. This works great and we are quite happy. But unfortunately we can not pre-define the custom-sorting on measures. In our example below 'L4L' is properly sorted, but if a user adds 'Day of Week' as row or column it get sorted alphabetically. What is the best way to deal with it?  

Thanks in advance for your support.

rows: [
{uniqueName: "L4L", customSorting: ["Existing", "New", "Closed"]},
{uniqueName: "Country"},
{uniqueName: "Own-Store"},
{uniqueName: "Retailmanager", active: false},
{uniqueName: "Store"}
],
columns: [
{uniqueName: "[Measures]"}
],
measures: [
{
uniqueName: 'Day of Week',
calculated: false,
caption: 'Day of Week',
customSorting: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
active: false
},
{
uniqueName: 'CS',
calculated: false,
aggregation: 'sum',
caption: 'Consumer Sales',
format: 'euro',
active: true
},
{
uniqueName: 'CS NET',
calculated: false,
aggregation: 'sum',
caption: 'Consumer Sales',
format: 'euro',
active: false
}]

2 answers

Public
Iryna Kulchytska Iryna Kulchytska Flexmonster October 28, 2016

Hi Jan,  

Thank you for writing your question here.
The property customSorting works for hierarchies in rows, columns and pages. Unfortunately, it does not work in measures. I have prepared a sample for you that illustrates how the days of the week can be sorted properly https://jsfiddle.net/irynakulchytska/a3387xth/. The component supports the sorting of months and the days of the week. The sample is based on JSON data and the first element of the JSON is used to define the data types:

{
"L4L": { type: "string" },
"Country": { type: "string" },
"Store": { type: "string" },
"Day of Week": { type: "weekday" },
"CS": { type: "number" },
"CS NET": { type: "number" }
}

More details about data types in JSON can be found in the following article in the documentation https://www.flexmonster.com/doc/managing-data-presentation-json. If your data source is CSV, please read about defining the data types in CSV https://www.flexmonster.com/doc/managing-data-presentation-csv/.   By default, the days of the week are sorted according to the following order: “Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”. This order can be changed in a localization file. The following line in the sample defines the localization for the report:

localSettingsUrl: "https://s3.amazonaws.com/flexmonster/2.2/loc-en-workdays-order.xml"

Inside the localization file the block <weekdays> defines the following order: “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”.   If you need to pre-define the custom-sorting for hierarchies that have string data, like “L4L”: { type: “string” }, you need to select them for rows, columns or pages.   Please let me know if the above information was helpful.  

Kind regards,
Iryna

Public
Tanya Gryshko Tanya Gryshko Flexmonster November 25, 2016

Hello Jan and all Flexmonster users,
Please have a look at our updated recommendations after the release of version 2.3. Now localization is set via JSON. You can read more in localization article.
Check the updated sample: https://jsfiddle.net/flexmonster/uhnx6enz/
The localization for the report is defined this way:

localization: "loc/fr.json"

Also, customSorting property was renamed to sortOrder.
Regards,
Tanya

Please login or Register to Submit Answer