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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

MACRO - How to select a specific value in Listbox on Sheet Selection

This is my first time using macros in Qlikview (and macros altogether in a very long time) I have a simple question regarding a macro when selecting a sheet.

I would like a specific listbox with years to be automatically selected with the latest year.

So on the OnActivateSheet Trigger, i have a macro which clears the selection:

ActiveDocument.Fields("Year").Clear

How would I get the field to be selected with the latest year?

The 'Year' field is in a 'Dates' table which has been retrieved on the load.

Hopefully somebody can help.

Thanks!

-Mike

14 Replies
Not applicable
Author

Sorry to utlize this thread, but I was struggling with the same sort of issue, but I can't seem to make this work.

I am using version 9, and tried what biester suggested: Document Properties > Triggers > OnOpen > Select in field.

In Field I have "[AP Date]" (stands for Accounts Payable date), and Search String "= Max ([AP Date])", but this does not choose the latest date in the list. What is wrong?

Thanks, - TP

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Does it select any value? Can you post the qvw?

-Rob

Not applicable
Author

Hi,

I'm also struggling with this. I´m trying to use the new functionality with triggers instead of using macros in order to improve the performance.

I'm having a variable generated in the script containing a Period. I then want to use this variable in my trigger in order to select a Year Month by default in the chart.

I´m trying to use the activity "Choose in field" and then use my variable as a search string to my field. For some reason this doesn´t work. It works fine if I hardcode a Period instead of using my variable.

Any idea anybody?

Regards

Not applicable
Author

Here are the Trigger properties (OnOpen action): nothing is selected.

Not applicable
Author

Perfect ! Thanks!

It works fine!