Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
If you are a Qlik Insight Bot user, join this collaborative group: JOIN GROUP
New Contributor II

Set default year option in chart using dynamic trigger

I have a chart which has year filters (e.g. 2018, 2019, 2020). The year filters are checkboxes vs. radio buttons so the user can select multiple years. I currently have a trigger on open that successfully defaults to the current year on open.

I set up a dynamic trigger on the change event for the Year field so that if all of the years in the filter are unchecked, then it checks the current year and only displays the data for 2020. Unfortunately, when all of the year checkboxes are unchecked, all the data for all the years is displayed instead of 2020.

=If(GetSelectedCount(DateCompletedYear)=0,DateCompletedYear=Year(today()))

Any idea how I would accomplish what I am looking to do here?

Thank you, D

1 Solution

Accepted Solutions
Highlighted
Honored Contributor II

Re: Set default year option in chart using dynamic trigger

Maybe like attached!

 

View solution in original post

8 Replies
Highlighted
Honored Contributor II

Re: Set default year option in chart using dynamic trigger

please share a sample qvw.

Highlighted
New Contributor II

Re: Set default year option in chart using dynamic trigger

Hi Frank. I am not in a position to provide the QVW as I would have to spend a good deal of time stripping out proprietary information. It should be relative easy to take a QVW add a chart with Year filters and test out the dynamic triggers. - D

Highlighted
Contributor

Re: Set default year option in chart using dynamic trigger

Instead you could create a measure using {<Year>}.

Of course it all depends on how you want it to work, but I believe this could be an alternative.

Not using it in the filter, but in the measure:

=If( getselectedcount(DateCompletedYear) =0,

{<DateCompletedYear={'2020'}>} Measure ,

Measure ) 

 

(I suggest creating the Year column in the script)

Hope it helps

Highlighted
Honored Contributor II

Re: Set default year option in chart using dynamic trigger

i have not asked for the original but a sample app.  if it is like you said, then you probably should be able to provide exactly this  qvw where you replicated the problem to get a common basis for further discussion. For further questions here in this forum i recommend always to put some effort in creating the thread and to add an example qvw because this way you will probably get a solution very fast!

PS:  Qlikview has the option to scramble sensitive fields.

Highlighted
New Contributor II

Re: Set default year option in chart using dynamic trigger

I am relatively new to QlikView and a coworker has been helping me with my dashboard. I am not entirely familiar with Measures or their usage.

It appears that the filter 'clear' (unselecting all of the Years no the clear button per se) displays all the data and even though we have a dynamic trigger set on the field's change event, it does not appear to override the functionality of the 'clear' like a button event does. We used =If(GetSelectedCount(DateCompletedYear)=0,Year(today()),DateCompletedYear) in the change trigger to no avail. Does anyone know of an innovative way to override the filter clear?

D

 

Highlighted
New Contributor II

Re: Set default year option in chart using dynamic trigger

Here you go. I put added the triggers on Open and change. D

Highlighted
Honored Contributor II

Re: Set default year option in chart using dynamic trigger

Maybe like attached!

 

View solution in original post

Highlighted
New Contributor II

Re: Set default year option in chart using dynamic trigger

Thank you Frank (and everyone).