Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

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
_action_phase
_action_phase
nopaneltrue
 node.

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 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 Use the following steps:

  1. In the application screen, right-click on the Save button, then click Display Actionflow.
  2. PhixFlow opens the actionflow that is connected to the Save button. Above the canvas is the phase toolbar.
  3. In the phase toolbar, click
    Insert excerpt
    _add
    _add
    nopaneltrue
    .
  4. Select Add Phase Before and set the Name to Validation. PhixFlow adds a new Validation tab to the phase toolbar.
  5. Click the Validation phase tab. PhixFlow displays the actionflow canvas for this phase.
  6. In the Inputs panel, add the form as an input into the actionflow.
  7. Map the fields that need to be validated: CompanyName and Number
  8. Drag a 
    Insert excerpt
    _action_calculate
    _action_calculate
    nopaneltrue
    node onto the actionflow canvas and set its Name to Validate Fields.
  9. Connect the
    Insert excerpt
    _driving_interface_connection_point
    _driving_interface_connection_point
    nopaneltrue
     to the calculate node.
  10. Map CompanyName and Number into the calculate node.
  11. 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
      nopaneltrue
      .

  12. Drag a 
    Insert excerpt
    _action_phase
    _action_phase
    namestart
    nopaneltrue
     node onto the actionflow canvas and select Processing Phase.
  13. Hover your mouse pointer over the calculate node and select the out connection point.
  14. PhixFlow creates a wire. Click onto the canvas to show the node options and select the 
    Insert excerpt
    _action_gateway
    _action_gateway
    nopaneltrue
    node.
  15. Set the Name to  Valid Records Only. PhixFlow adds the gateway node.
  16. Right-click on the connection point between the calculate and the gateway nodes and click 
    Insert excerpt
    _action_map
    _action_map
    nopaneltrue
  17. Map ValidRecord into the gateway node and click Confirm Mappings.
  18. Hover your mouse pointer over the gateway node and click Add Output. Set the Name to Valid.
  19. Click on the 
    Insert excerpt
    _action_phase
    _action_phase
    namestart
    nopaneltrue
     node to wire the gateway output into the start phase node
  20. Right-click on the wire and select Show Properties.
  21. 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: