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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

list box for multiple container objects using macro

I've a multi-tabbed/sheet dashboard, one tab/sheet of which contains 4 container objects. Each of these container objects (CT12 - CT15) contains 3 charts inside it, named 'YTD', 'MTD' and 'Mkt Val'. Our requirement is to create a list box to select the chart type to display in all the containers at once.

I've created an INLINE table to hold the Chart Values,

Comparison:

LOAD * INLINE [No., Chart

1, YTD

2, MTD

3, Mkt Val]

and created a list box for [Chart] using this. In addtion, I've defined the variable vSel  =Max({$}[No.]) to get the numeric value corresponding to the chart selection.

I've then defined a macro trigger on the [Chart field] (OnSelect):

SUB SelectComparisonChart

Objects = ActiveDocument.ActiveSheet.GetSheetObjects

For i = lBound(Objects) To uBound(Objects)

     IF LEFT(Objects(i).GetObjectId,11) = "Document\CT" THEN

          SET ContainerProp = Objects(i).GetProperties

          ContainerProp.SingleObjectActiveIndex = vSel-1

          Objects(i).SetProperties ContainerProp  

     END IF

next

end sub

however, this only seems to be working for the first selection i.e. YTD. In essence, if YTD chart is selected it will set all container objects to show YTD chart but this does not seem to work for MTD and Mkt Val charts, it seems to be working for only the first value in the inline table.

Any ideas on what I may be missing here? Thanks.

2 Replies
marcus_sommer

Are you sure that you macro will be executed like do you want? For testing reasons I would put an additionally msgbox "macro executed" within the routine. Further within your routine is no statement to get your variable-value and often it's very helpful to avoid strange results by implementing some WaitForIdle statements.

Another point could be the index-number, sometimes it begins with 0 and sometimes with 1 - I'm not sure in this case.

- Marcus

Anonymous
Not applicable
Author

I ended up using conditional show on the chart groups instead of using container objects with macros, looks and works much cleaner.