Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

1 Solution

Accepted Solutions
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.

View solution in original post

17 Replies
sparur
Specialist II
Specialist II

Hello,

as I understood, you have a slider object, which built on 2 variables. You can initialize these variables in Actions when your qvw-documen is opening. Go to Settings->Document Properties->Triggers->OnOpen Event Trigger-> Add Actions (for initializing your variables)

Not applicable
Author

I gathered as much as that I could something with Actions. However, once I'm beyond "Add actions" I have no idea what to choose and how to configure it. Need I say I'm pretty new to QlikView?

jonathandienst
Partner - Champion III
Partner - Champion III

Alternatively set the variables in your script (not macro) with something like:

Set vLowerLimit = 0;

Set vUpperLimit = 100;

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sparur
Specialist II
Specialist II

When you press Add Actions, Go to Action Type - 'External' -> Action 'set Variable' -> press OK. Then select variable name and value

Not applicable
Author

I see. The problem here is that my slider isn't connected to any particular variable but connected to a field (week).

christian77
Partner - Specialist
Partner - Specialist

Hi:

See the example. It is very easy. On triggers you can Select, Lock, Clear, etc any field you want at any time. You just have to set up the trigger.

Not applicable
Author

I played around a little with the Actions and I've now managed to set one of the slider-values on open. But since it is a multi-value slider I naturally want both min and max-values set.

To set one value I did this: Document Properties->Triggers->OnOpen->Edit Actions, then I chose "Select in Field" and set Field as "CalendarWeek" and Search String as "='W' & Week(Now())".

Now when I open the document the current week is chosen on the slider. But I want the span of (12 weeks ago) to (this week) chosen. How do I set the min-value (12 weeks ago) as well? The things I've tried so far haven't worked.

christian77
Partner - Specialist
Partner - Specialist

Hi:

Have you seen the attachment?

Everything is there.

Do you want to select or do you want to deselect when opening?

Ok Select

Week '>=1<=12' for example.

Not applicable
Author

Yes, I've seen the attachment. I hadn't seen it when I wrote my last post though

But I can't seem to figure out how it works. What is it that tells the slider to select 2-6? All I see is a triggers saying to Clear Other Fields on open. I really don't understand how that causes 2-6 to be selected on the slider. If I wanted 3-5 to be selected instead, how would I modify your document in order to do that?

The field I'm using for my slider is a string so I'm not sure if I can use <= and >= on it (it doesn't seem like it). The field is a concatenation of the letter 'W', the year in 2 digits and the week. So this week is W1124 for example.