Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Slider object - Linked to Dates - Need to set upper and lower limits

Hi - hope someone can help

I have an application up and running in which i select the 'Event Date' using a multi value slider object limked to the 'Even Month'

e.g. I set boundaries between Mar 2009 and Feb 2010

This works absolutley fine.

I have data in the app going back to 2005, and the upper and lower limits of the slider seem to automatically set themselved to the earliest and latest Event Month.

Now - I want to limit the slider rand to Sep 2009 - Mar 2010, without having to remove the data outside of these dates.

I've tried playing with the Min Value and Max Value fields, but these only seem to come into effect when the Continuous/Numeric value option is ticked, if i do this it stops displaying the slider as a date and instead shows it as a number.

Can anyone advise how i would go about limiting the values on the slider, whilst retaining the date/month format?

Thanks in advance

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Build a new slider, but instead of selecting a field or a variable, tell it to use <expression>. It's in the field drop down list. Then enter an expression like

if("Event Month">=date#(20090901,'YYYYMMDD') and "Event Month"<date#(20100401,'YYYYMMDD'),"Event Month")

I assume you'll actually want to calculate your endpoints instead of hardcoding them, but that's the idea.

View solution in original post

10 Replies
johnw
Champion III
Champion III

Build a new slider, but instead of selecting a field or a variable, tell it to use <expression>. It's in the field drop down list. Then enter an expression like

if("Event Month">=date#(20090901,'YYYYMMDD') and "Event Month"<date#(20100401,'YYYYMMDD'),"Event Month")

I assume you'll actually want to calculate your endpoints instead of hardcoding them, but that's the idea.

Not applicable
Author

Thanks John

Not applicable
Author

hi john,

I am having two fields i.e; months and dates.

In my file i taken month as listbox and dates as slider.

when i select particular month through listbox then the slider should display on that month dates.

How can i work on this

Thnks

johnw
Champion III
Champion III

It doesn't look like QlikView allows for that. I assume it figures that a slider bar is exactly like a list box. And just like how a list box displays ALL values, not just possible values, the slider displays all values.

So do this:

create a vDate variable
make a slider object for the vDate varaible
min value: =min({<Date=>} Date)
max value: =max({<Date=>} Date)
static step: 1
create an OnInput trigger for the variable
actions: select in field
field: Date
search string: =date(vDate)

There might be a better way, but that should work.

Not applicable
Author

hi john,

i am using multi value in mode. so now i need to select two variable for this.

If i am using single value and giving single variable what you had in your post, i tried but it is not changing the values in the charts based on date selection.

Is there anyother process to work on this .

Thnks

johnw
Champion III
Champion III

The same basic idea works with two variables. Same min, max and static step in the slider. You need a trigger for both variables of course, and the search string is a little different since it must reference a range instead of a single value. This seems to work:

='>=$(=date(vFromDate)) <=$(=date(vToDate))'

See attached.

johnw
Champion III
Champion III

Heh. I really should have read the whole thread. I think I like my April 2010 suggestion better than the variables and triggers approach, though both work. I've added the <expresssion> version of the slider to the example. Currently, the variable-based slider sets the field-based slider, but not vice-versa. This wouldn't matter in practice because you'd use one approach or the other, not both.

Not applicable
Author

hi john,

My Qlikview is not a full version, so i cannot open your attached file. Please can you send the screenshots of attached file, this will be helpful to me.

Thnks

johnw
Champion III
Champion III

This is the script:

Calendar:
LOAD *
,date(monthstart(Date),'MMM YYYY') as Month
,date(yearstart(Date),'YYYY') as Year
;
LOAD date(makedate(2010)+recno()-1) as Date
AUTOGENERATE 730
;

This is the listbox expression approach:

This is the variables and triggered selections approach (use the same trigger and action for both variables):

And this is the result: