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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Force 1 date

Hi,

How can I ensure that at all times exactly 1 (not 0, not more than 1) date is selected.

I checked the "single value" field on the calendar, but that doesn't prevent me from having "no value".

To clarify, I want the user to be forced to have 1 date selected at all times.

1 Solution

Accepted Solutions
Not applicable
Author

You can force one and only one value to always be selected by:

1. displaying the date in question in a ListBox
2. select a single date
3. Go to Properties of the ListBox and on the General tab tick 'Always one selected value'

Regards,

Jonas

View solution in original post

5 Replies
prieper
Master II
Master II

Hi,

you can have "no value" only, if it is in the underlying field. Thus would suggest to exclude this possibility in the script

HTH

Not applicable
Author

You can force one and only one value to always be selected by:

1. displaying the date in question in a ListBox
2. select a single date
3. Go to Properties of the ListBox and on the General tab tick 'Always one selected value'

Regards,

Jonas

Not applicable
Author

also, make sure that one date is selected when you save the .qvw... this will ensure that always one is always selected, and never can none be selected.

BUT, why do this? wouldn't it be better to allow the user to make selections? What if I want to see totals for the entire month, or just Tuesdays, or months beginning with J?

Not applicable
Author

Good point Anthony. The only scenarios I've ever implemented using 'Always one selected value' are scenarios revolving FX rates for dynamic currency conversion throughout a document or language selections for multi-lingual applications. I.e. scenarios where it simply makes no sense to have anything more than one value selected for any type of analaysis. Food for thought.

Not applicable
Author

My application uses a template .QVW. The values are not known until data is explicitly loaded.

I would like to restrict a particular date field to a single value, but the 'Always one selected value' option is not possible here since I don't know ahead of time what the value is. There is no data in the template, so I can't select an initial date.

I suppose it might be possible to initialize the date and then use macro code to check the 'Always one selected value' option, but this seems rather ungainly (assuming it's even possible). My current solution is just as ungainly: the field event trigger OnSelect calls a macro which enforces the single selection.

The 'Always one selected value' is a tantalizing feature, but it is not complete without some way to initialize the data.

Joseph Lin, Software Development Engineer

.

Terra Technology | Accurate. Current. Consistent.