Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Triggering a macro on the evaluation of an expression variable

Hi All,

I need a document variable event 'on change' trigger to run a macro, my problem is that the variable is an expression, the triggers only seem to work when the actual value contained in the variable changes.

this is my variable

vWeeklyMonthly

which contains

=if(GetCurrentField(date_dimension) = 'Week Ending','Weekly',if(GetCurrentField(date_dimension)='Month Year','Monthly'))

I need to trigger my macro when the expression in the variable changes from 'Monthly' to 'Weekly' or vice versa.

does anyone know how to achive this?

Thank you

1 Solution

Accepted Solutions
Not applicable

Re: Triggering a macro on the evaluation of an expression variable

Well it looks like it may be...

Before_Cyclic_Change.jpg

After_Cyclic_Change.jpg

All I did was change the cyclic group...

9 Replies
Not applicable

Triggering a macro on the evaluation of an expression variable

Try to use a 2nd variable that equals the first then set the trigger to run on that variable change.

So something like this:

vCalc = if(Sum(Rate) > 0, 'True', 'False')

vAns = $(=vCalc)

then set the trigger to run when vAns changes.

Not applicable

Triggering a macro on the evaluation of an expression variable

This doesn't work unfortunately, it would seem that the content of the variable needs to change e.g. from 1 to 0

as the expression itself never changes it doesn't trigger the macro.

Not applicable

Re: Triggering a macro on the evaluation of an expression variable

I made a little demo...  it seems to be working.  Maybe I missunderstood the question?

Not applicable

Re: Triggering a macro on the evaluation of an expression variable

Your example works perfectly, I think the problem arises when trying to trigger a macro on a expression which is the result of a cyclic group. I've attached a file

which demonstrates this.

Previous discussion on topic :

Trigger on Cyclic groups

Not applicable

Re: Triggering a macro on the evaluation of an expression variable

So if I understand correctly... You want to trigger a macro when the cyclic group changes? Yes?  If that is correct then you should be able to just add a trigger to the variable you set up (vCalc2) and it will run the macro code.  Am I understanding correctly now or am I still missing the idea?

Not applicable

Triggering a macro on the evaluation of an expression variable

That's exactly what I'm trying to do. Unfortunatley adding a trigger to vCalc2 doesn't seem to work, if you click the

cyclic group in 'zack_2.qvw' the macro does not trigger.

Not applicable

Re: Triggering a macro on the evaluation of an expression variable

That's very strange... on my version of zack_2 it works.  Everytime you change the cyclic group from 'Name' to 'Sex' or vice versa it runs the macro.  What version of QlikView are you using? 

Mine is: 10.00.9061.7 SR3 64-bit

Not applicable

Re: Triggering a macro on the evaluation of an expression variable

10.00.8935.7 SR2 32 - bit

Please don't tell me this is yet another bug!

Not applicable

Re: Triggering a macro on the evaluation of an expression variable

Well it looks like it may be...

Before_Cyclic_Change.jpg

After_Cyclic_Change.jpg

All I did was change the cyclic group...