Get Free Trial
Get Free Trial

Filter requires two passes over the data

Bill Hamill asked on July 23, 2019

We use an MSAS datasource and your Fields dialog to define our slice, including filters. Applying filters is a two step process:

  1. The desired fields are added to the Filters list. The slice definition is applied and the pivot table is updated.
  2. The filters are defined and applied and the pivot table is updated again.

This makes two passes over the data. Is there any way to eliminate a pass? Do you have any suggestions? For example:

  1. Can we define the filter directly in the Fields dialog as we add it to the Filters list?
  2. Can we pause updates until the slice is completely defined?

Thanks for your help.

2 answers

Public
Vera Didenko Flexmonster July 24, 2019

Hello,
 
Thank you for writing to us.
 
 
At the moment Flexmonster doesn’t support defining Filters in the Field List and pausing updates until the slice is completely defined. 
The reason for this is that members of selected fields are loaded only after the changes in the Field List are applied.
 
 
Our team kindly suggests implementing your own Field List supporting the needed behavior.
Flexmonster provides a list of API calls that can be used for adding functionality to your Field List.
For more details about how a custom Field List can be created, please see the following thread: https://www.flexmonster.com/question/prevent-to-modify-fields-options/
 
Adding a filter option during field selection can be implemented in case you decide to create a custom Field List. 
 
The general idea lies in the following steps: 
 
1) Create your Filter pop-up window. Add “Apply” and “Cancel” buttons to it.
 
2) Add a button in the desired place for opening the Filter pop-up for the specific field.
 
3) Upon opening the Filter pop-up, get all members of the needed field with the getMembers() API call and display them in the Filter pop-up.
 
It is important to keep in mind that for OLAP data sources the callbackHandler needs to be specified, for example:

flexmonster.getMembers('[Product].[Product Categories]', '', 'onGetMembers');

function onGetMembers(members) {
for (var i = 0; i < members.length; i++) {
console.log(members[i]);
}
}

If data load is in progress and callbackHandler is not set an empty array will be returned.
 
4) Save the applied by user Filter settings in the form of the Filter object
 
5) Construct the slice object by specifying the selected fields and their filter settings in the rows, columns, measures, and reportFilters sections.
 
An important remark is that the selected filter settings should be specified in the filter parameter for each prefiltered field in the rows, columns, measures, and reportFilters sections accordingly.
 
When the user applies the Field List configurations, pass the constructed slice object to the runQuery() API call in order for the desired changes to come into effect:

flexmonster.runQuery(newSlice);

 
 
You are welcome to contact us in case of questions.
 
 
Best Regards,
Vera

Public
Bill Hamill July 24, 2019

Hi Vera,
Thanks. This is great information. I will look into this when I get some time.

Please login or Register to Submit Answer