< Back

Action batches in their simplest form can be used to group actions that need to be executed together. Sometimes a widget’s touch events or senor events can have 30-40 small actions, as changing a text, a text color, a button color, a value in a datasource, etc each have their own action. Sometimes it even means duplicating the event conditions. To solve this issue, we can choose “Execute action batch” as action type and copy related actions inside it. Batches have a “Note” field, its only purpose is to write down what the batch does so it’s easier to understand later.

Sent fields

We can send in data from multiple sources, such as the received sensor event, interactive widget’s values, fields in datasources, etc.
Learn more about them in the Sent fields section.

Conditions

Sent fields can be used in conditionals, this way we can evaluate data that came from different sources. For one action inside an action batch, these conditions have an “AND” relationship, meaning the corresponding action will only be executed when each condition is met. If for an action, you don’t care about a value of a field, just leave it at “has changed to anything”. Unlike Datasource events, it will trigger, even if the value is the same as the last time.

Using them as values

The received value inside an action batch is an object with the sent fields, thus we can use them with the Value origin set to “Property of received value”. Note: We won’t see this option if the “Simplified view” is turned on at the bottom of the dialog.

Content wide

Sometimes we need to repeat the same action for multiple events. We could just use the “Copy action” utility and add it to each use case and often it is a good solution.

However, if it’s more than one action or requires parameters, a Content wide Action batch is better.

When we change “Actions origin” to “Content wide”, we can choose from previously created content wide batches in the current content. If we need a new, just “Create new”, give it a name and add all the actions.

If we need to change anything later, we can just access the batch from anywhere it’s used, change it, save it and it will change everywhere. Note: The batches are identified by their name, so sometimes a content can be saved by creating a batch with the same name for a previously deleted batch if something went wrong. However, it is safe to rename a batch, it will be renamed for each use.

We can also parameterize these batches. The type and/or origin of the sent fields can be different for each use, as long as the names are the same. This way, we can create a universal popup: Create a page, name it something like “Popup”. Add a text widget and any decoration you need. Somewhere where you want to use it, add a Content wide Execute action batch with a sent field named e.g., message. Inside, add two actions. First, “Interact widget” on the “Popup” page with the text widget and set Value origin to “Property of received value”. For property name, type the field name (message). The second action is just a “Popup” action that “Opens” the “Popup” page. From now on, you can use this anywhere from this content, just select it from the available Content wide batches and add any type of sent field with the name “message”. 

Delay

We can also delay actions using batches. It can be useful for creating a toast message that is visible for only a couple of seconds.