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: 
Not applicable

Default Selections: Macro

Hi all,

Can anyone share a sample application having a macro for default selection.

I want to apply this macro post relaod.

All my objects are in a particular state . Would that affect the macro?

Thanks

Khushboo

Labels (1)
1 Solution

Accepted Solutions
pamaxeed
Partner - Creator III
Partner - Creator III

Check it out.

It works....

I corrected the syntax, now it is working fine.

Regards,

Patric

View solution in original post

17 Replies
pamaxeed
Partner - Creator III
Partner - Creator III

Hi,

what you mean with all my objects are in a particular state. Would that affect the macro?

Regards,

Patric

Not applicable
Author

I am very much new to macro.

I mean say in a list box-product .i want to select default value as Product-A.

This list box is in a state -A?

can anyone help me with this macro.

Khushboo

pamaxeed
Partner - Creator III
Partner - Creator III

So you are using alternate states in your app?

You can try to to do something like that:

ActiveDocument.Fields("YourField", "State1").SelectValues("yourValueHere")

Cheers,

Patric

Not applicable
Author

so if i write this macro :

sub Default

ActiveDocument.Fields(".PGRP_LVL_1_DESC_TXT", "state-A").SelectValues("Product-A")

end sub

and on post reload ....apply this macro Default.

It should work ?

Thanks

Khushboo

Not applicable
Author

after reload i am redirected to that macro

marcus_sommer
MVP
MVP

Does this macro work if you execute it from the modul-editor per click on Test-Button? What is the reason for these selection then normally a reload changed no former selection?

- Marcus

Not applicable
Author

when i test this macro.it gives type mismatch error?

pamaxeed
Partner - Creator III
Partner - Creator III

Check it out.

It works....

I corrected the syntax, now it is working fine.

Regards,

Patric

marcus_sommer
MVP
MVP

If I have a closer look on your statement I notice the attempt to select this field within a certain state but the APIGuide didn't know such a parameter and I think it made no sense, too then a field is global and only sheets respectively sheet-objects could belong to a state. Further the syntax isn't quite correct then it must be:

ActiveDocument.Fields("MARKETSIZINGV1.PGRP_LVL_1_DESC_TXT", "Explore_OAMS").SelectValues("Prevnar Franchise")

- Marcus