Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
linoyel
Specialist
Specialist

Trigger to clear previous date selection

Hi,

In my sheet a user can select either dates (from and to) in the Calendar Object, or he can select Date from separate List Box.

I managed to connect the Calendar Object selections to the Date List Box, so when a user pics From and To dates from the Calendar, in Current Selections box it shows: Date ='>=' &_DateFrom & '<=' & _DateTo (the On Select Trigger).

Now, after this, a user for example wants to select a specific date from Date List Box. Current Selections Box updates in a right way, but the Calendar Object remains with previous selections.

I need a trigger which will erase those selections if the user selects date from Date List Box.

Thank you!

16 Replies
Anonymous
Not applicable

I mean to remove all actions from the _DateTo and_DateFrom fields, and instead add a button, and create "select in Date" action there.  It may be useful in addition to the solution you have already.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

As Michael as also said dates can be much more easily applied in expressions when they are coming from variables.  If you want the user to select dates by using separate fields and these separate fields need to be applied in various ways you can achieve this by having your calendar in a data island (eg. don't join it to anything else) and then have variables that pick values from that data island, eg. a variable vMaxDate that contains =max(Date).

I've a couple of examples uploaded to QlikCommunity looking at applying dates in Set Analysis, for prior period compare, but similar code could be applied for implementing a range.

It sounds that your initial problem is fixed, but hopefully these other approaches may give you something to consider in future.

-Steve

linoyel
Specialist
Specialist
Author

Steve, I'm looking now at your "At The Qlik of a Button" presentation, and I'd like to implement it in my work.

In my case it's a bit different: I have a List Box with 4 values, and I want to show a chart I've built only when user picks a certain value from that List. How can I implement that using variables? 

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Linoy,

If it makes sense to have a list box, perhaps as a data island, with those four values in you don't need to use variables.  Just have a Show Condition on each chart something like:

=Only(ListBoxName) = 'Chart1'

You would then need a text box to show when more than one option was picked in the list box, to advise that an option must be made, the Show Condition on that would be:

=GetPossibleCount(ListBoxName) <> 1

If you want to do the same using variables, as I would tend to do, you would need to set up four text boxes, each with an action to set a variable to a value, and then the Show Condition would be:

=vShowWhichChart = 'Chart1'

Another QlikCommunity example I have uploaded shows show and hid functionality with variables:

QlikView App: Show and Hide Windows Dynamically

The document on Buttons is backed with a blog post and video, and can be found here:

QlikView App: At The Qlik Of A Button

Hope that helps.  Please post back if you have any more specific questions on implementing this.

Steve

linoyel
Specialist
Specialist
Author

WOW!

The " =Only(ListBoxName) = 'Chart1' " works amazing!

When multiple values are selected, you wrote to build a text box "to advise that an option must be made" - what do you mean? Should I write in the Text Box that a user must pick only one value? And what if I want to show the chart if at least (not only) one of the relevant selections has been made?

Another thing: I guess I'm missing something in understanding the connection between 4 Text Boxes and 4 values in the List Box. My List Box is not a data island, it's connected to lots of tables and when a user picks one of the values there, he gets information on that selection. If I would like to set Text Boxes instead of each one of the values of the original List Box, how would I connect a Text Box selection to the information which is supposed to be presented on that selection?


stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

If you have a space on the screen where you have hidden an object you ought to put something else in it's place.  The simplest approach is a Text Box with text on, saying something like 'Your Selections Must Include Chart 1 To View This Chart' and then the show condition would be the opposite of what you have on the chart, eg:

=Only(ListBoxName) <> 'Chart1'

The other approach is not to use the Show Conditional, but go for the Calculation Condition instead (on the General tab) you can then set an Error Message for the Calculation Condition Not Set error, and put your text there.

To show an object when any one of a number of selections includes the right one you could do this:

=maxstring({<ListBoxName*={'Chart1'}>}ListBoxName) = 'Chart1'

This is basically checking for Chart1 in any of the values using Set Analysis, if Chart1 doesn't appear in the list then Null will be returned by the maxstring function.

The four text boxes with actions that I referenced were regarding an approach that didn't use listbox values.  If the toggle you want is not directly related to the data - rather just user selection - then I find buttons and variables a better approach.  It doesn't sound like that is the case for you?

Cheers,

Steve

linoyel
Specialist
Specialist
Author

Steve, thanks for your help and the examples, I've tried all you've presented and it worked

In my case user selections actually are related to data, so I understand I have to stay with List Boxes meanwhile.

The " only([Tran Type]) = 'Declined' " was exactly what I was looking for to implement.