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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Select values in straight table chart using a macro

Hello,

I would like to create a macro that automatically selects values in a chart based on a variable's value.

I have a variable called Status that has a value of either A, B, C, or D. This variable is used as a dimension in a straight table chart.

When I run my macro, I would like to select lines in my chart where Status has a value of A or B. I have tried several different variations of the macro below, but it is not working.

sub Selects

arr1 = Array("A", "B")

ActiveDocument.Fields("Status").Select arr1

end sub

Seems like it should be fairly straightforward. Any thoughts about how I can get this macro to work?

Thanks!

Michael

2 Replies
marcus_sommer

You need a loop to read the array-values:

sub Selects

arr1 = Array("A", "B")

for i = 0 to ubound(arr1) - 1

     ActiveDocument.Fields("Status").Select arr1(i)

next

end sub

But what is the reason for this routine?

- Marcus

Anonymous
Not applicable
Author

Thanks for the response Marcus, but that does not seem work either. The edit module window opens whenever I run the macro.

I am trying to add a few buttons to my Qlikview doc that allow me to quickly switch between different views of my chart, rather than selecting each field from a list or menu.

Is it possible to accomplish this without using an array?