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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
terezagr
Partner - Creator III
Partner - Creator III

Select certain year in the list box by using variable

Hi all,

I have this list box where I store data about years:

year

2015/6

2014/5

2013/2

2012/1

I would like the year 2014/5 to be pre-selected for users when they open the application. I have been trying this with some variables, but unfortunately not very successfully.

Do you have any advice how to do this?

Thank you for your advice in advance!

Labels (1)
8 Replies
maxgro
MVP
MVP

Hi

try to use a trigger at the document level (Settings --> Document Properties --> Triggers) on the OnOpen event and add a Select in Field Action on Year field (search string 2014/5)

Regards

Anonymous
Not applicable

Tereza

Do test this early in WebView / AccessPoint Ajax mode as I fear they do not support OnOpen Triggers, even though they work perfectly in the standard Qv Desktop.

Best Regards,     Bill

MK_QSL
MVP
MVP

Go to any sheet and right click

Properties

Triggers

OnActiveSheet

AddAction

Add

Selection

Select in Field

Field = Year

SearchString = 2014/5

terezagr
Partner - Creator III
Partner - Creator III
Author

Thanks for the advice guys, but it does not work for me. Also at the moment I want the year 2014/5 be pre-selected, but in some point in the future I would like 2015/16 selected etc. So with the roll-over to another year the SearchString would have to be changed, which in my opinion is not the best practice.

I am thinking about having a variable set in my load script, where max(year)-365. Any thoughts on this approach?

Cheers T.

peschu123
Partner - Creator III
Partner - Creator III

Hi TerezaGr,

I'm not sure if this is helpful in your case but I use a document trigger to select a date range.

Settings --> Document Properties --> Triggers --> Document Event triggers --> OnOpen --> Add --> Select in Field...

Field: Date

Search String: ='>=' & weekstart(today(0)) & '<=' & weekend(today(0)+200)

Perhaps it is helpful and you can use it in your scenario.

It works in QV Desktop and Ajax (QV AccessPoint).as well.

Best Regards and I hope its helpful,

Peter

maxgro
MVP
MVP

Thanks for info Bill, I tested it and in Ajax OnOpen doesn't work.

Not applicable

Hi evrybody

to use a variable, it is not SELECT in field  but "External", "set variable"

best regards

Chris

peschu123
Partner - Creator III
Partner - Creator III

Hi Chris,

in general you are right.

I don't know exactly what T. wants to do, but perhaps it is not neccessary to use a variable. Or the variable can be set during script run and than used in the search expression of the trigger event.

By the way, I didn't saw that