Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
VBA_Master
Contributor II
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

Labels (4)
1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

Maybe like attached!

 

View solution in original post

8 Replies
Frank_Hartmann
Master II
Master II

please share a sample qvw.

VBA_Master
Contributor II
Contributor II
Author

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

Gui_Approbato
Creator II
Creator II

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

Frank_Hartmann
Master II
Master II

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.

VBA_Master
Contributor II
Contributor II
Author

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

 

VBA_Master
Contributor II
Contributor II
Author

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

Frank_Hartmann
Master II
Master II

Maybe like attached!

 

View solution in original post

VBA_Master
Contributor II
Contributor II
Author

Thank you Frank (and everyone).