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

Makro, which selects item out of a listbox and shows this in an existing diagram.

Hello,

i want to write a makro, which automatically

1. selects an item, for example "DR_a_x", out if a listbox (ObjectID "LB18"),

2. puts this in an existing diagramm (ObjectID"CH13"), which is linked to the listbox.

3. detaches the diagram.

How can i realise this with VBScript?

The listbox and the diagramm exist, therefor they dont have to be created. The detaching does work.

Best regards,

Mila

5 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

hi,

PFA. I hope this what you are looking for.

Anonymous
Not applicable
Author

Thank you for the fast answer. Unfortunatly i cannot open the document because i have only the free version. Could u insert the makro text in this forum.

deepakk
Partner - Specialist III
Partner - Specialist III

hi ,

This is the Macro Code

set v = ActiveDocument.Variables("vTest")

if v.GetContent.String = 1 then

ActiveDocument.GetSheetObject("CH01").Attach

else

ActiveDocument.GetSheetObject("CH01").Detach

end if

You need to create a Variable with below expression
=if(getselectedcount(Fieldname whichneed to be selected)=0,1,0) .
Now in Seetings-->Document Properties-->Triggers -->Field Event Trigger onSelect and OnChange.
Add a event. Action Run Macro and MacroName.
Best of Luck


Anonymous
Not applicable
Author

Hi,

i have some difficulties implementing your suggestions. What is the vTest? How should i name the Variable, which needs to be defined =if(getselectedcount(Fieldname whichneed to be selected)=0,1,0) ?

many thanks.

Mila

deepakk
Partner - Specialist III
Partner - Specialist III

hi Mila,

vTest is the variable. You can name the variable as you required.

I had created vTest as the variable and stored that expression. and then I used the vTest in the macro.