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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
raynac
Partner - Creator II
Partner - Creator II

Macro Assistance

I am hoping someone can direct me to the right code for something.

If a macro looks like this:

Sub SecondQtr

     ActiveDocument.ClearAll(false)

     ActiveDocument.Fields("Quarter").Select("Q2")

end sub

I am looking for "Sub NOTSecondQTR", more or less.  Is there anyway to select everything that's NOT Q2?  Obviously, when there are only 4 options you can dictate which three to choose, but in the code I am writing, there are about 20 options, of which I am trying to exclude a single one.  I looked in the reference manual but didn't see anything.

Any help would be appreciated!  Thank you!

4 Replies
danielrozental
Master II
Master II

You should probably use actions for this. You could try selecting a value and then do "toggle select" or select excluded.

raynac
Partner - Creator II
Partner - Creator II
Author

Hi Daniel...thank you for your response!

I have been working with Qlikview for years but am somewhat new to Macroes.  The "toggle select" is something that can be written into the macro?  I know the "select excluded" is a right click action, and there is no way that my company owner is going to be ok with having to do something manual.

danielrozental
Master II
Master II

I'm not talking about doing anything manually, Actions are a feature implemented in QV9 to replace most common macro uses.

img11.png

You can also do it in a macro

ActiveDocument.Fields("Month").Select ">4"

ActiveDocument.Fields("Month").ToggleSelect "<8"

raynac
Partner - Creator II
Partner - Creator II
Author

Oh, thank you Daniel!!  I will take a look at this and see if I can accomplish what I am trying to do 😄

Best,

Rayna