Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to set values of slider on open

Hello,

I have a multi-value slider that determines what span of weeks to do various calculations and produce charts for. I would like for the slider to have the weeks from twelve weeks ago to the current week selected automatically when my QV-document is opened. Is there a way to do this? Preferably without a macro since I already have way to much macro-code in this project

17 Replies
christian77
Partner - Specialist
Partner - Specialist

Move your pointer over the right side of the moving part of the slider. Now click anf drag to the right.  See the pictures.

simple.jpg

multiple.jpg

Not applicable
Author

I'm not sure we're understanding each other here. I know how to change the slider once the document is open in the QV Desktop application. But what I'm trying to do is have a span selected automatically at the moment when the document is opened and the span must be relative to the current date. Like this:

I have a slider connected to a field called "CalendarShortYearWeek". This field contains values that are the concatenation of 'W', year in 2 digits and week in 2 digits. The slider shows these values from one year back up to today. So today it is showing 'W1024' at the farthest left and 'W1124' at the farthest right.

When I open the document today I want the span 'W1112' to 'W1124' to be selected automatically. When I open the document next week I want the span 'W1113' to 'W1125' to be selected.

I hope that clarified what I'm trying to do. Sorry if my previous explanation wasn't all that good

Right now I've managed to have it select just one of the dates when I open the document but this is not good enough. I need the span to be selected as described above.

Not applicable
Author

If i understood your question properly, could do this with weekstart function.

Your expression should be some thing like this. Use the below expression in select in field of action in on open trigger.

='>='&week(date(MaX(weekstart)-77))&'<='&week(MaX(weekstart))

Check the attached application.

- Sridhar

Not applicable
Author

I understand what you did there but I'm having problems modifying it for my purposes. I think my problem is that my slider is connected to a field that is a string and because of that I'm having trouble constructing an expression that does what your expression does with numbers.

My slider contains 'W1050', 'W1051', 'W1052', 'W1101', 'W1102' and so on up to 'W1124' which is this year and this week. Due to project demands I can't change this to a strictly numerical value unfortunately. It has to look like that and use those values.

So I would have to do something like

='>=(12 weeks back expressed as 'Wyyww')<=(this week expressed as 'Wyyww')'

but I just can't seem to write the expression correct for it to work.

Not applicable
Author

We can do this with Dual Function.

check out the attached application and your expression in "Select in Field" should be as follows.

='>='&Right(Year(date(MaX(weekstart)-77)),2)&Num(week(date(MaX(weekstart)-77)),00)&'<='&Right(Year(date(MaX(weekstart))),2)&Num(week(MaX(weekstart)),00)

Edit: Week Field which you are creating at backend should be binded to numeric value (i.e. Year & Week ) using dual function.

Hope this helps you.

christian77
Partner - Specialist
Partner - Specialist

That's why I prefer numbers instead of strings.

Every time you need to do operations you are going to have the same problem.

What if you want to know the week before, or three weeks before? Same problem…

I suggest you:

1st Get rid of the W in that field.

2nd When is time to show it, add the W, like ‘W’ & Week.

Not applicable
Author

It's working now! The Dual-function is what did the trick finally.

A million thank yous to all that helped out

Anonymous
Not applicable
Author

Hello,

I've a similar need,

May you suggest how to manage the same for Quarters having following Structure:

Q2'2013

In particular way if now is Q2'2013...

I have to select based on a certain offset (i.e. 😎

Q2'2013, Q1'2013, Q4'2012, Q3'2012 , Q2'2012, Q1'2012, Q4'2011, Q3'2011

May you suggest?

Thanks and Regards,

Giuseppe