Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Execution order of actions

Is there any way to control the order that actions are run or should I go back to macros?

16 Replies
Miguel_Angel_Baeyens

Hi,

Within the same object (say, a button), actions are run from top to down, the first in the list of actions will run first, and so on. If you have some OnOpen triggered actions, this will run prior to any other action.

Is that what you were looking for?

Miguel

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Hi Miguel,

On this topic, I have a button that runs 3 actions:

1.     Select in Field: Field=%PointInTime, Search string = (Daily*|MTD*|QTD|YTD)

2.     Run a macro (enables/disables chart expressions)

3.     Set Variable:     Variable=vPiT_Choices_LastSet, Value = Concat(DISTINCT %PointInTime,',')

Looking at this you would expect the variable in step 3 to set to the result of the Select in Field action (step 1) which is what I want. However, you have to click the button twice for this to work.  My tests are showing that the result of step 1 is ignored by step 3.

Any ideas?

Thanks,

Jason

Not applicable
Author

Hello

I have the same issue, I need to click my button twice for all 3 actions to execute. Were you able to resolve this?

Thanks,

Ben

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Afraid not.  It's a bug in QV where a string of actions doesn't respect its own field changes.  I had to split them into two places.

Not applicable
Author

Jason, by splitting it into 2 places, do you have 2 seperate buttons now or did you do something else. Thanks.

rwunderlich

The doc does say that "The actions will be executed in the order in which they appear in the list.", but I've never had any luck getting them to execute serially.

-Rob

Jason_Michaelides
Luminary Alumni
Luminary Alumni

I think so. Something like a Save and an Update/Apply button.

ChristofSchwarz
Partner
Partner

There seems to be an undocumented rule like "Set before select" ... call it a bug or not ... If you have a block of actions within a button or textbox or trigger and intend to use a SET VARIABLE action after a SELECT-action (like SELECT FIELD or CLEAR FIELD or others....) and you expect to get the result from that selection into the variable, you will NOT get it. The variable will be set before the selection change becomes effective, no matter in which sequence you put it.

This is the status until today (QV 11.2 SR3)

WORKAROUND - HELP WITH ANOTHER TRIGGER (Not for Ajax!)

If you like to get a field value into a variable after you changed the selection in the same action, you will need the following "ingredients":

  • a new field, not linked to any other data,
  • A on-select trigger on that new field
  • The action itself will first define, a) which variable to change and b) the expression to execute into two temp-variables and
  • then set the new field (the one with a trigger) to a dummy value.
  • The on-select field trigger, finally, sets the expression (as given in a temp variable) into the desired variable (whose name was also given in a temp variable).

The point of time, when the on-select field trigger is executed, is then indeed AFTER the selections made by the action button and will deliver the desired result. It is demonstrated on the below example, where the green action button

  • captures the current selection of FieldX into variable A
  • changes the FieldX selection
  • captions the new selection of FieldX into variable B

See https://dl.dropboxusercontent.com/u/92495732/Action%20Set%20Variable.qvw

I have to admit, that the Ajax Client only executes one action block at a time. If one action sets a field, which has a trigger on it, Ajax client (or Web preview) does not execute the trigger. If you manually change the field (the one with the trigger) in Ajax, the trigger will be fired. So: My above example is not Ajax-ready!

mark_casselman
Creator
Creator

Same issue here.

Made 3 actions on a button to switch the contents of 2 variables A and B:

     - set variable 'temp' to the value of 'A'

     - set the variable 'A' to the value of variable 'B'

     - set the variable 'B' to the value of variable 'temp'

But, this doesn't work.

I think it's a 'bug'.

Any other solution to switch variable value between 2 varaiables ?