Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
Overview
Actionflows process data one record at a time. However, sometimes you may want to process all records up to one point, before moving on to the next process. For example, you may first want to check all the data before starting to process the first record. One way to do this is to have separate actionflows, so that all the data is processed by one actionflow, saved to a table and then the table is used at the start of the next actionflow. The other way is to use a
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Phase nodes act as an internal break in the actionflow. For example, you can have one phase in which records are read into the actionflow and checked one at a time. Once all records have been validated, the actionflow can then move to the next phase, where records are updated. Phase nodes are particularly useful if there the actionflow requires the user to make a choice as part of the actionflow.
Configuring a Validation Phase
An example of a validation phase is when a user wants to check some company fields before saving them in an actionflow. The simplest way to do this is to add a new phase before the existing processing phase. The new phase will contain all the logic to check the fields, and only pass on validated fields to the next phase.
To:
- add validation to the fields
- check that a company name has been provided
- check that the phone number only contains numbers.
use the following steps:
- In the application screen, right-click on the Save button, then click Display Actionflow.
- PhixFlow opens the actionflow that is connected to the Save button. Above the canvas is the phase toolbar.
- In the phase toolbar, click
.Insert excerpt _add _add nopanel true - Select Add Phase Before and set the Name to
Validation
. PhixFlow adds a new Validation tab to the phase toolbar. - Click the Validation phase tab. PhixFlow displays the actionflow canvas for this phase.
- In the Inputs panel, add the form as an input into the actionflow.
- Map the fields that need to be validated:
CompanyName
andNumber
. - Drag a
node onto the actionflow canvas and set its Name toInsert excerpt _action_calculate _action_calculate nopanel true Validate Fields
. - Connect the
to the calculate node.Insert excerpt _driving_interface_connection_point _driving_interface_connection_point nopanel true - Map
CompanyName
andNumber
into the calculate node. - Create a calculate attribute with the following properties:
- Name: ValidRecord
- Type: TrueFalse
Expression:
Code Block do( //set error message variable to use in the validation $errorMessage = [], //check the company name is populated if(in.CompanyName == _NULL, $errorMessage = addElement($errorMessage, "Please provide a name") ), if(contains(in.Number, [abc]), $errorMessage = addElement($errorMessage, "Phone number should not contain any letter") ), if(countElements($errorMessage) > 0, do( error(listToString($errorMessage, ", ")), false ), true ) )
To save the calculate attribute, click
.Insert excerpt _save _save nopanel true
- Drag a
node onto the actionflow canvas and select Processing Phase.Insert excerpt _action_phase _action_phase name start nopanel true - Hover your mouse pointer over the calculate node and select the out connection point.
- PhixFlow creates a wire. Click onto the canvas to show the node options and select the
node.Insert excerpt _action_gateway _action_gateway nopanel true - Set the Name to
Valid Records Only
. PhixFlow adds the gateway node. - Right-click on the connection point between the calculate and the gateway nodes and click
Insert excerpt _action_map _action_map nopanel true - Map
ValidRecord
into the gateway node and click Confirm Mappings. - Hover your mouse pointer over the gateway node and click Add Output. Set the Name to
Valid
. - Click on the
node to wire the gateway output into the start phase nodeInsert excerpt _action_phase _action_phase name start nopanel true - Right-click on the wire and select Show Properties.
In the wire properties → Basic Settings → Expression, add:
Code Block in.ValidRecord
This ensures only valid records pass to the next phase.
The completed validation phase of the actionflow looks like this:
Configuring a Confirmation
PhasePhase
Anchor | ||||
---|---|---|---|---|
|
A confirmation phase is useful if the user must:
- confirm an action before it runs
- choose an option to determine which phase runs.
In this case, configure a phase with an
node that contains a start phase button. Link the button directly to the outputs on an open screen node.Insert excerpt _action_screen _action_screen nopanel true
A confirmation phase usually opens a popup window. The following steps assume this screen has already been designed.
To add a confirmation phase:
- In the phase toolbar, click
.Insert excerpt _add _add nopanel true - Select Add Phase Before and set the Name to
Confirmation
. - In the Inputs panel, configure the input into the actionflow:
- If you want to map data into the confirmation phase, add the form as the input.
- If you do not need any data, add the event as the input.
- Click
to open the list of available screens. Drag the confirmation screen you require onto the actionflow.Insert excerpt _screen _screen nopanel true - Connect the confirmation screen to the interface input connection point.
- Drag an
node onto the canvas and select the phase to run after the confirmation has completed.Insert excerpt _action_phase _action_phase nopanel true - Hover your mouse pointer over the screen node and select Add output
- Set the Name to
Out
and connect this to the
node.Insert excerpt _action_phase _action_phase nopanel true - Right click on the open screen node and click Configure Button Mappings
- Map the Confirm button to the
out
output connection point. This means when a user clicks the confirm button, it will cause the connected phase to run. - Optionally, if a custom confirmation message is required, a calculate node can be added between the
and theInsert excerpt _driving_interface_connection_point _driving_interface_connection_point nopanel true
node. Attributes can be created here to map into the dynamic text fields on the confirmation screen. To find out more, see Calculate Node and Open Screen Node.Insert excerpt _action_screen _action_screen nopanel true
Learn More
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|