Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro - find MonthName current selections

Hello,

I would like to accomplish 1 of 2 things in a Qlikview document:

1) On a chart I would like a Calculation Condition that find the number of MonthName items that are selected. And if there is at least 1 selection then it should display the chart. I have so far:

=Count(distinct[MonthName])>0

However this just reads what MonthName items are available with the other current selections, not what MonthName items are selected.


OR

2) I would like the opening Macro of the sheet to know find what MonthName items are selected. If none are selected, then to select "Jan" or all months that are available. If one MonthName is selected then to do nothing.

I hope somebody can help me with one of them

Thanks!

-Mike

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

1) =getSelectedCount(MonthName)

You shouldn't even need to say >0, because 0 is false, and anything else is true.

View solution in original post

4 Replies
johnw
Champion III
Champion III

1) =getSelectedCount(MonthName)

You shouldn't even need to say >0, because 0 is false, and anything else is true.

Not applicable
Author

Thanks John, that works! Anybody know how to do #2?

johnw
Champion III
Champion III

I think this (untested):

sub DefaultJan()
set field = ActiveDocument.getField("MonthName")
if field.getSelectedValues.Count < 1 then
field.select "Jan"
end if
end sub

Not applicable
Author

Works great. Thanks again!