Gateway Action Configuration
What is a Gateway Action?
The action acts as a decision point and controls Gatewaythe path that records take as they flow through an Actionflow. Data flow is controlled by the expressions on each output connection point and these provide the logic for which path the data flows. Several output connection points can be added, with decision logic on each one.
Exclusive vs Inclusive
Control whether or not a record is pushed through one or more outputs.
(Single Path) Exclusive Gateway
Toggle on
to push a record through the first connection point where the condition is met.(Multiple Paths) Inclusive Gateway
Toggle off
to push a record through all connection points where the conditions are met.Rules
For each output connection point, rules (expressions) can be defined to be evaluated. If the condition is met, the record will go through the connection point or points (depending on if the gateway is exclusive or inclusive, see above).
The order number assigned to each rule determines the order the rules are evaluated in. The gateway output connectors display this number with the output connector name, e.g. out : 1.
Creating Gateway Actions
- Click and drag the Gateway icon in the toolbar onto the canvas
- Enter a name for the Gateway action, then select Create Action
- In the Gateway action on the right: Properties
Toggle on Exclusive
or toggle offDefine Rules for each output connection point clicking the icon
- all settings Apply and Close
- Hover over the action on the canvas to see the output connection points Gateway
- Click on each connection point to connect it to another action node
- Once connected, the Gateway Rules will open on the right where the Rule expression can be changed
- Or, right-click on the connector and choose Edit Expression
Example Setup
This is an example of a simple gateway Actionflow that receives an order status. Where the order status is Open, an email is sent but where the order status is Complete, the data is saved.
Worked Example
Here's a worked example using the Retail Data (available from the Learning Centre).
In this example, we are using:
- A Shop Stock screen containing a grid of the Shop Stock data, a pie chart of the Shop Stock data and a grid of the Shop Departments data - this screen was created using the Multi-Tile template
If you are completing this chapter as part of the Actionflow course and using a training instance, the data and screens have already been pre-loaded into the Actionflow Intermediate Application. For this example, we'll be working on the grid on the Shop Stock screen.
Disable Save For Blank Records
For this example, we'll create an Auto Save Actionflow that includes a action that disables a save action where a record is blank but allows the save where the record is populated. Gateway
Setup In-Grid Editing
On the Shop Stock screen, open the configuration for the Available Stock grid View
- On the , in the View Attributes section, double-click the attribute, itemType Properties tab
- In the Grid Settings section, untick Read Only
- the View Attribute settings Apply and Close
- On the configuration, click on the View, and in the Action Settings section, toggle on Actions tab Auto Save
- all changes Apply
Auto Save Actionflow
- In the Action Settings section, under Auto Save Action Method, choose Actionflow
- For the Auto Save Actionflow, click the icon to create a new Actionflow
- Name:
NullCheck
- Name:
- On the Actionflow, select Click to Connect and choose the Shop Stock data source
- The window will open: Connector Mappings
- For What data is being used? select Edited Records
- Map in the itemType and itemID attributes into the Actionflow
- The itemType attribute is needed for the Gateway Rules
- The itemID attribute is needed to save records back to the Shop Stock data
Gateway Setup
- Drag a Gatewayaction onto the canvas and give it a suitable name
- Drag the input connection point node onto the Gatewayaction
- Click on the connector between the the input connection point and the Gatewayaction
- Map in the attribute, itemType, into the action Gateway
- Click on the Gatewayaction and toggle on Exclusive
- In the Rules section, double click on the top rule to open the Gateway Rule properties:
- Rename this,
Save
Enter the Rule:
in.itemType != _NULL
- This will map records where the Item Type is changed and is not blank
the Apply and CloseGateway Rule properties
- Rename this,
- In the Rules section, add another rule:
- Name:
Stop
Enter the Rule:
in.itemType == _NULL
- This will map records where the Item Type is changed and is blank
the Apply and CloseGateway Rule properties
- Name:
the Gateway properties Apply and Close
Save Setup
- Add a Save action to the canvas that saves records to the Shop Stock Processed table
- Toggle on Auto Save Attributes in the properties and Apply
- Hover over the Gatewayaction and select the save output connection point, then connect this to the action Save
- Map across the itemID attribute from the Gatewayaction to the action Save
- Note that this attribute was not directly mapped into the Gatewayaction and has instead passed through it
- For more information on setting up a Save action, see 1.09 Save Action Configuration
- Note that this attribute was not directly mapped into the Gatewayaction and has instead passed through it
- Map across the itemID attribute from the Gatewayaction to the action Save
Stop Setup
For the stop route in our Actionflow, we want the record to not be saved back to the table if it is blank and instead we want to show an error popup to the user.
- Add a action to the canvas Calculate
- Create an Output Attribute, named
ErrorText
and containing the string:"Please provide an item type"
For more information on setting up a Calculate action, see 1.11 Calculate Action Configuration
- Add an Open Screen action to the canvas that opens the screen, Shop Error Popup
- Hover over the action and select the stop output connection point, then connect this to the Gateway Calculate action
- Hover over the Calculate action and select the out output connection point, then connect this to the action Open Screen
- Map the Output Attribute, ErrorText from the Calculate action to the dynamic text component, ErrorMessage on the screen, Shop Error Popup
For more information on setting up an Open Screen action, see 1.07 Open Screen Action Configuration
- Map the Output Attribute, ErrorText from the Calculate action to the dynamic text component, ErrorMessage on the screen, Shop Error Popup
Testing
- the Shop_Stock_Processed View configuration properties Apply and Close
- Close the Actionflow and Shop Stock screen
- Reopen the Shop Stock screen and it Lock
- Double-click on a cell in the Item Type column on the Available Stock grid and make the following changes to see your Actionflow in action:
- Edit the text in a cell, then click into another cell to see the first cell auto save
- Delete the text in a cell, then click into another cell to display the error popup
- Note, the cell will not save unless it contains a value