Versions Compared

Key

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

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

Extracting Actions

Action nodes, within an Actionflow, can be re-used by extracting them from their original Actionflow and converting them into a new Actionflow. In the original Actionflow, the actions are transferred to an embedded Actionflow node.

The newly created Actionflow automatically contains:

  • input, output and lookup connection points to connections outside of the new Actionflow, e.g. to action nodes and the original Actionflow
  • all transferred action nodes 
  • the original attributes, which are mapped to match the original Actionflow setup

Creating a Reusable Actionflow

  1. To make a reusable Actionflow, select the required action nodes and right-click to choose 
    Insert excerpt
    _extract_actionflow
    _extract_actionflow
    nopaneltrue

    1. A new Actionflow is automatically created
    2. On the original Actionflow, the selected action nodes are replaced with the new embedded Actionflow node - see Actionflow Node


Note

Important Considerations:

  • All action nodes requiring extraction must be connected
  • If a
    Insert excerpt
    _action_loop_start
    _action_loop_start
    nopaneltrue
     or
    Insert excerpt
    _action_loop_end
    _action_loop_end
    nopaneltrue
     is extracted, its corresponding end/start loop must be extracted too
  • Insert excerpt
    _action_phase
    _action_phase
    namestart
    nopaneltrue
     actions cannot be included in the extraction

  • Any passthrough attributes must be mapped into the original Actionflow

Worked Example

Here's a worked example using the Shop Data (available from the Learning Centre).

In this example, we are using:  

  • Customer Form screen containing blank input fields, set up to create a new staff member  - this screen was created using the Edit Form template
Tip

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 Save button on the Customer Form screen.

GIF/SCREENSHOT OF FINISHED RESULT

Extract Proper Case Calculate Action

In this example, we'll modify the Actionflow on the Save button for when a customer is created. We'll configure this Actionflow to convert the string entered for the First Name attribute to proper case, for example, if the user enters "JOHN" or "john", this action will convert this string to "John". 

We'll then extract this Actionflow and use it on the Save action on the Staff Form.

Create Proper Case Calculate Action

  1. Open the Actionflow on the Save button on the Customer Form
  2. Add a
    Insert excerpt
    _action_calculate
    _action_calculate
    nopaneltrue
     Action
  3. Drag the Calculate Action onto the connector between the input and Save action
  4. Click on the input connector under Connections and map in the first_name and last_name attributes
  5. Map these two attributes into the Calculate action
  6. Create a new Output Attribute that will convert text to proper case, using the following Expression


    Code Block
    titleExpression
    do(
    
        // put the name into lowercase, e.g. "john"
        toLower(in.first_name), " ", 
            
            // put the first letter into upper case, e.g. "J"
            $firstLetter = toUpper(substring(in.first_name, 1,1)), 
                
                // put the name from the 2nd letter onwards into lower case, e.g. "ohn"
                $remainingLetters = toLower(substring(in.first_name, 2)), 
                    
                    // create a new proper case name using the upper case first letter and lower case remaining letters, e.g. "J" + "ohn" = "John"
                    $newName = $firstLetter+$remainingLetters
    )


  7. Click on the connector between the Calculate action and the Save action

  8. Map across the new Output Attribute onto the first_name attribute

  9. Close the Actionflow and Customer Form
  10. Reopen the Customer Form and enter a First Name in upper or lower case, then press Save to test the Actionflow

Extract Proper Case Calculate Action

  1. Re-open the Actionflow
  2. Right-click on the Proper Case Calculate Action and choose 
    Insert excerpt
    _extract_actionflow
    _extract_actionflow
    nopaneltrue
  3. Name the Actionflow: Proper Case
    1. This Actionflow can now be used elsewhere in your application

Embed Extracted Action in Actionflow

  1. Open the Actionflow on the Save button on the Staff Form
  2. Click 
    Insert excerpt
    _actionflow
    _actionflow
    nopaneltrue
     in the toolbar and drag the Proper Case Actionflow from the Repository
  3. Drag it onto the connector between the input and Save action
  4. Choose the out_ProperCase connection point from the Select Connection Point pop up
  5. Click on the connector between the Proper Case and Save action
  6. Map across the ProperCase attribute from the embedded action node to the firstName attribute on the Save action 

1.02 Actionflow Principles