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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statement to change selections between two multi select boxes.

I am working with a macro in one of my QVWs. I am receiving the following error on this IF statement.

sub SelectSDStore

if ActiveDocument.Fields("OPCO") = ("Store A") then

ActiveDocument.Fields("Store_Info").Select "12-Store 12",1

end if

End Sub



ERROR: Object doesn't support this property or method

I am trying to get the value of one multi select box and if it equals that value, I want to default the selection of the store number. Is there a better route of doing this?

Thanks for any information

1 Solution

Accepted Solutions
Not applicable
Author

So here is the code that will work............

SUB SeeValues
SET s = ActiveDocument.Fields("field1").GetSelectedValues

For x = 0 to s.Count - 1

IF s.Item(x).Text = "C" THEN ActiveDocument.Fields("field2").Select "C1"

Next

END SUB


Obviously change field1 and field2 for your names, and then change the comparison and select text.

View solution in original post

5 Replies
Not applicable
Author

You're IF statement should be:

IF ActiveDocument.Fields("OPCO").GetContent.String = 'Store A' THEN ..................


That should do the trick for you.

Not applicable
Author

Scrub that, I'm wrong, I've just given you the code for a variable rather than a field.

When you say that the field is in a multi select box, does that mean that you might have multiple values selected and in this case you want to know if Store A is one of those values selected?

Thanks,

Not applicable
Author

So here is the code that will work............

SUB SeeValues
SET s = ActiveDocument.Fields("field1").GetSelectedValues

For x = 0 to s.Count - 1

IF s.Item(x).Text = "C" THEN ActiveDocument.Fields("field2").Select "C1"

Next

END SUB


Obviously change field1 and field2 for your names, and then change the comparison and select text.

Not applicable
Author

Thanks! This worked perfectly.

Not applicable
Author

What is the syntax to default an option to have multiple selections for Field2? I think I have tried everything so far and this is what I have come up with.

IF s.Item(x).Text = "OPCO" THEN ActiveDocument.Fields("GMM_Info").Select "C1" and "C2"

Any help is greatly appreciated.