The global filters – a functionality frequently requested when talking about the online composition scenario.

The issue

Using the components “Fragment Gallery” and “Split Cell Container” you an easily allow users to create own fragments (called also smart objects) and dashboards. The only issue (or feature) was – every single fragment contains of the visualization and data source with all filter values. Now, when placing into split cell container it stays on the filters which were assigned at the creation time. Change of those is not possible at all, as there is no access to the data source (as those were dynamically created at runtime and have some generated name).

The solution

There is a new function in Split Cell Container –

SPLITCELLCONTAINER_1.getDataSources();

Using this function you can now access the data sources included in the split cell container.

In connection with Filter Panel function

FILTERPANEL_1.setDataSource(dataSourceAlias);

you can take the first data source and assign to the filter panel which will get the members from this data source.

How to find the first data source?

In split cell container, there is an event on Drop”, there you can place this script:

var dataSources = SPLITCELLCONTAINER_1.getDataSources();

dataSources.forEach(function(element, index) {

  if(index == 0) {

  FILTERPANEL_1.setDataSource(element);

  }

});

(consider also some script in the “on Delete” event…)

How to distribute the filters?

In the “on Apply” event, you can again loop at all data sources of the split cell container and copy the filters.

var allDataSources = SPLITCELLCONTAINER_1.getDataSources();

var masterDataSource = FILTERPANEL_1.getDataSource();

allDataSources.forEach(function(element, index) {

  if (element != masterDataSource) {

  element.copyFilters(masterDataSource);

  }

});

Other aspects

The same way can be used with Filter Line component. There is not “on Accept” event, but there is a script function

FILTERLINE_1.setTargetDataSources(datasources);

which makes logically a filter copy.

Example.

For an example of this functions, you can refer to the template “Online Composition” (New -> select the template) and its function:

gf.PNG

Questions, Ideas welcome.

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Fahad Ajaib

    First of all thanks for posting such helpful stuff. I am actually facing performance issues in an Online Composition Scenario. I have to build 5 Dashboards with each dashboard containing 10 charts / KPI’s. To achieve this I am basically using Pagebook with 5 pages where each page contains a Splitcellcontainer inside a compose panel. I have 1 datasource in the application that I am filtering for every chart and then saving this chart as PortableFragmentBookmark and then adding 10 of these fragments into each splitcellcontainer. So I have 5 compose panel with 50 charts / fragments and at the end I am saving each compose panel as FragmentBookmark. Now everytime when I have to load these 5 bookmarks the application is actually loading 50 datasources 1 for each chart which is taking too much time. I find your post helpful but don’t know how to implement it in my scenario. I have also 1 datasource that I am filtering for each chart. Can you kindly help me in this regard, how can I improve the performance or how can I avoid loading the data source 50 times. thanks and best regards. Fahad

    (0) 
  2. Dwayne Winters

    Any idea why my call to SPLITCELLCONTAINER.getDataSources() doesn’t return any data sources? With code below I always get 0.

    var cDataSources = SPLITCELLCONTAINER_1.getDataSources();

    APPLICATION.createWarningMessage(“Datasources: “+cDataSources.length);

    (0) 
      1. Dwayne Winters

        I must correct my last reply – it is not the backend connection object, but having a data-bound control within the bookmark that makes the data source available in the receiver application.

        (0) 

Leave a Reply