banner



How To Add Filters In Qlik Sense

Qliksense-selection-on-multiple-apps-mashup-bi-analytics

This web log is almost applying filter selection across multiple applications from a mashup. This is essential in scenarios where nosotros have apps that share common data fields. For example, 60 minutes organisation and project management systems may take different information and for some reason this need to be split up, nosotros can merge them together in the mashup and apply filters together.

In this example, for simplicity, a re-create of Helpdesk app, that is role of the example apps that comes along with
Qliksense desktop implementation, is created and a nautical chart title is renamed for explanatory purpose.
You can download the working source code of this mashup from GITHUB.

One primary objective of this arroyo is to Non utilize any custom filters as that would require additional development and maintenance efforts. Also, if not implemented correctly information technology may atomic number 82 to performance dethrone.

Technically, one may meet 2 scenarios where filter needs to be practical on more i app.

Secnario 1: A single folio that renders visualization from more than one app to the user

Scenario 2: Two separate modules (pages) exist and user goes from ane module (page) to another and the context (filter selection) needs to exist preserved between the modules. Or at that place is a need to preserve option between two different sessions.

Scenario 1: Single page that renders visualization from more than one app to the user
  • Place one of the apps as the primary apps.
  • Create filter pane from this app to have the common fields
  • Render the filter pane in the mashup
  • Use the following function to capture selection modify and apply it to the second app.Downside of this is that the selections made in the charts of the secondary app may not reflect in the filter. In this case you tin can disable selection on the charts. If yous practise not want the option on the charts disabled, then you will accept to create custom filter and utilize selections to both apps together.

    var selState = app.selectionState( ) ;
    var listener = function ( ) {
    app2.clearAll( ) ;
    var selFields = selState.selections;
    if (selFields!= null ) {
    $. each (selFields, function ( key , value) {
    var valArray= [ ] ;
    $. each (value.selectedValues, role ( primal ,value) {
    valArray.push(value.qName) ;
    } )
    app2.field(value.fieldName) .selectValues(valArray) ;
    } ) ;
    }
    } ;
    selState.OnData.bind( listener ) ;

Scenario 2: Applying filters across pages or preserving selection between two sessions of the same page

The implementation is like to the in a higher place except that filter selections are transferred only on the page load. In the example, I take used this to retain the filter selection betwixt multiple sessions.

  • Create filter panes on the apps
  • Render them in the respective mashup page
  • Apply the following role to capture the selection change and store the choice in the browser enshroud

$. each (selFields, function ( primal , value) {
cacheString=cacheString + '@' + value.fieldName + "~" + value.qSelected;
}

localStorage.setItem( "QlikFilter" ,cacheString) ;

  •  When the corresponding mashup page loads, read the local storage and utilize the filters accordingly.

    role retrieveSelectionfromCache( )
    {
    var cacheString= localStorage.getItem( "QlikFilter" ) ;
    if (cacheString!= null && cacheString != "" ) {
    app.clearAll( ) ;
    var selFields=cacheString. split up ( "@" ) ;</li>
    </ul>
    $. each (selFields, function ( cardinal , value) {
    if (value!= zero &amp;&amp; value!= "" ) {
    var valArray= [ ] ;
    var s = value. dissever ( "~" ) ;
    var fieldName=due south[ 0 ] ;
    valArray = s[ 1 ] . split ( ", " ) ;
    app.field(fieldName) .selectValues(valArray) ;
    }
    } ) ;
    }
    else {
    app.clearAll( ) ;
    }
    }

Source: http://www.codewander.com/qlik-sense-mashup-apply-filters-across-two-or-more-apps/

0 Response to "How To Add Filters In Qlik Sense"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel