Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

mila_ayuhara
New Contributor III

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
Valued Contributor III

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

hi,

PFA. I hope this what you are looking for.

mila_ayuhara
New Contributor III

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

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
Valued Contributor III

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

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


mila_ayuhara
New Contributor III

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

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
Valued Contributor III

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

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.

Community Browser