Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro for changing variable value depending on certain fields

Hi,

i want to create a macro which changes the value of two variables depending on the state of 9 fields, of which 7 have an '=0' condition and the other two need to bechecked fr some specific value in the field.

When i did this it states error.

if ActiveDocument.Evaluate("GetSelectedCount(Field1)")=0  and

                    ActiveDocument.Evaluate("GetSelectedCount(Field2)")=0 and

                    ActiveDocument.Evaluate("GetSelectedCount(Field3)")=0 and

                    ActiveDocument.Evaluate("GetSelectedCount(Field4)")=0 and

                    ActiveDocument.Evaluate("GetSelectedCount(Field5)")=0 and

                    ActiveDocument.Evaluate("GetSelectedCount(Field6)")=0 and

                    ActiveDocument.Evaluate("GetSelectedCount(Field7)")=0 and

                    ActiveDocument.Evaluate("GetFieldSelections(PG)='Overall'") and

                    ActiveDocument.Evaluate("GetFieldSelections(LCC_GDS)='Overall'") then

 

                    ActiveDocument.Variables("vShow").SetContent 1,True

              ActiveDocument.Variables("vShow2").SetContent 0,True

    else

              ActiveDocument.Variables("vShow").SetContent 0,True

              ActiveDocument.Variables("vShow2").SetContent 1,True

    end if

End Sub

what need to be changed here?????    

1 Solution

Accepted Solutions
Not applicable
Author

Hello,

If you're getting a "syntax error", try adding an underscore " _" after the "and" in your if statement.

Just to link all lines together as one statement.

View solution in original post

1 Reply
Not applicable
Author

Hello,

If you're getting a "syntax error", try adding an underscore " _" after the "and" in your if statement.

Just to link all lines together as one statement.