Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Negation use of Select and ToggleSelect in Macro

Hi,

I am trying to work with onOpen doucment Event trigger that will run a macro - This macro will select certain fields. I am having an issue to try to find the correct logic or syntax to give me the general outcome I am looking to achieve.

What I'm looking to do: I want to Negate 2 selections ("A" && "B"). So that within my document the current selection object will show the negation == NOT A, B.

## This would select both "A" & "B" on document open.

## But is there syntax like Select Not "A" & "B"?

OnOpen [Event] --triggers--> Run Macro --calls--> Sub openSelections

Sub openSelections

.........

ActiveDocument.Fields("NAME").Select  "A"

ActiveDocument.Fields("NAME").ToggleSelect "B"

.........

End Sub

Can anyone assist in the syntax I'm looking for? I am looking for a macro solution to do this.

-Conor F.

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Does it have to be a macro? I would advise using just Actions instead of possible.

Select in Field:  (A|B)

Select Excluded.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

4 Replies
m_woolf
Master II
Master II

Can you just do SelectExcluded after your two lines?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Does it have to be a macro? I would advise using just Actions instead of possible.

Select in Field:  (A|B)

Select Excluded.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

Not applicable
Author

Rob -

I have decided to go your suggested route and make them Actions instead. However the compound select did not work in my case so I applied a toggle select instead. The compound select did not like the searches having multiple word strings like: ('Seller A'|'Buyer A').

My final solution was:

Select in Field: Field = Name; Search = 'A'

Toggle Select: Field = Name; Search = 'B'

Select Excluded: Field = Name


Thanks for your help!

- Conor

Not applicable
Author

m w -

I did something similar in my solution but in a Action instead.

I was unable to get the SelectExcluded to work properly in the macro:

ActiveDocument.Fields("NAME").Select  "A"

ActiveDocument.Fields("NAME").ToggleSelect "B"

ActiveDocument.Fields("NAME").SelectExcluded

Maybe I am using the syntax incorrectly?

- Conor

Community Browser