Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tdegen_qlik
Contributor
Contributor

Cascading Triggers (OnSelect)

I have an app. where users should be allowed to switch between a basic user mode and a collaboration mode.  Basic user sees detailed data from only their location.  Collaboration can see summary data from many locations.  The end result is a user can toggle between User/Collaboration and some hidden relational filters will be changed and some charts will be hidden/shown. The 'summary view of all locations' (collaboration) is a new feature being added to a very large and long lived application.  

For the most part it all works beautifully, however some of the cascading triggers do not get set properly.

I would prefer to do a pure relationship model, but it causes circular references.  Therefore I am using field level triggers to set values on the hidden filters. 

Ideally I would love to do a pure relationship:

VirtualProfileTable  --> Links to  --> LocationsTable

VirtualProfilesTable --> Links to --> SeveralHiddenFilterFields            <---- This causes a circular reference

 

Since the above does not work, I've chosen to use Field-level triggers (OnSelect, OnChange).   This works beautifully for the most part, but there are some cascading triggers (Field Filter values based on other fields that are changing).  Unfortunately, some of the fields do not change properly unless I click on already selected fields (like the trigger isn't firing). 


I understand that the trigger fires on a mouse click (i.e. I know I can't do an OnSelect on a hidden field I'm not actually clicking on - and that's okay). 

 

Table A has a relationship with Table B

When Table A is clicked, Table B values change and the TableA.OnSelect trigger does a Select In a Field on Table C where values are concat(TableB.Field). 

If I put the code in separate buttons and click them in order, everything works perfectly.  But if I chain then all inside one object (add several events to the OnSelect trigger) the final hidden filters are not being updated.  

 

 Is what I'm trying to do even possible? Do I need to add "sleep" events between steps, maybe?

 

1 Reply
marcus_sommer

Cascading triggers aren't possible at least not if they depend on each other because they aren't executed serialized else in parallel and you could not determine any execution-order.

In general it's not recommended to use a lot of magic with actions and macros to define the usability - else applying them only for challenges which couldn't be solved differently. Regarding to your described use-case everything should be possible with the native Qlik logic of selecting the wanted sheets/objects/field-values including also different view-level whereby the show/hide-feature of the sheets/objects/dimensions/expressions should be carefully used to not create rather confusion instead of helping the user.

If your mentioned mode isn't just aimed as a usability else should really restrict the access you should discard this approach and applying an appropriate section access.

Further I suggest to re-think your datamodel-approach because Qlik used an associative datamodel ideally applied within a star-scheme (all facts are merged - per concatenate and/or mapping/joining into a single table and n dimension-tables). It may need some efforts but isn't very difficult just follow the various best practice:

Get started with developing qlik datamodels - Qlik Community - 1485839

Pulling sql-schemes and just adjusting them that they didn't run into too much errors is usually  far away from having a sensible base to build an UI.

- Marcus