Add conditions to interactions

Conditions are used to control the action flow by determining whether certain action should be executed. The action won't be invoked if the condition returns false.

You can find action condition at the top right corner of the action panel.

Access data in condition

  • Access event data

    event.field_name. For example, event.value >= 10 represent the condition that the value event emit is larger than 10. Other variables in action input is also available.

  • Access element level data

    field_name

  • Access page level data

    #page.field_name

  • Access app level data

    #app.field_name. For example, a string app data named "current_user", #app.current_user == 'admin' represent the condition that current user is 'admin', meaning the action will only be invoked if current user is admin.

  • Access query node data

    #query_node_name. For example: #query_node_name.length >= 5 represents the condition that the query node have more than 5 elements, meaning the action won't be invoked if the query node have less than 5 rows.

Examples

Assume we have an action Set text after Press Enter for Input. For example, in the preview, we input a '2' in the box and press enter, then the text element is set to '4'.

Now, we add a condition event.value <=10 to the action. By doing this the action will only be executed when the input value is no more than 10. Then we Click Update and Preview to test. In preview, when a number equal or less than 10 entered, the number will double and set in the text element. On the other hand, if a number larger than 10 is entered, no changes will occur.

Last updated