Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
pkelly
Specialist
Specialist

Default List Box Values

Hi...

I have a list box with values A, B, C and D...

When the report opens I want values A nd C to default to be selected in the list box...

I appreciate that I could save my report with these values selected but this means that I will have to remember this everytime I modify / save the report...

Think that this will have to be done via a macro which loads when the report is open but am unsure how to do this....

Any help greatly appreciated...

1 Solution

Accepted Solutions
Not applicable

Paul,

This is how I set a default value in a macro that is invoked by being passed as a named pair:

set doc=ActiveDocument
doc.Fields("Contract Status").Select "Live"
doc.Fields("Contract Status").Lock

see toggle select if you have multiple values.

the URL looks something like this:

qvp://myserver/QVContracts/Contracts%20Analysis.qvw?MACRO=SetEnv

Regards,

Gordon (also on 8.20)

View solution in original post

6 Replies
fseregaza
Partner - Contributor III
Partner - Contributor III

Hi Paul,

I think you can use a trigger for that.

Settings > Document Properties... > Triggers (tab)

At the top of the tab, select "OnOpen" and click on "Add Action(s)". Then add the "Select in Field" action, write in "Field" your field (without quotes), and write in "Search String" something like "(A|B|C)" (with A, B and C the values you want by default).

I hope I answer your need.

Best regards,

Franck SEREGAZA

Business & Decision

pkelly
Specialist
Specialist
Author

Thanks Franck...

I do not have a document properties | trigger tab - think this may be applicable to earlier versions of the software - I am on version 8.2.

Think my solution lies in writing a macro...

Not applicable

Paul,

This is how I set a default value in a macro that is invoked by being passed as a named pair:

set doc=ActiveDocument
doc.Fields("Contract Status").Select "Live"
doc.Fields("Contract Status").Lock

see toggle select if you have multiple values.

the URL looks something like this:

qvp://myserver/QVContracts/Contracts%20Analysis.qvw?MACRO=SetEnv

Regards,

Gordon (also on 8.20)

fseregaza
Partner - Contributor III
Partner - Contributor III

Indeed, I'm using the last version (v9 SR2). Too bad for you, macros are not the best, but that's the only solution you have. Maybe you should think about moving to v9.

Best regards,

Franck SEREGAZA

pkelly
Specialist
Specialist
Author

Should hopefully be updating within the next 4 - 6 weeks....

Thanks for your suggestion - I will bear this in mind when we upgrade....

Regards

Paul

pkelly
Specialist
Specialist
Author

Thanks Gordon - this has done the trick...