Versions Compared

Key

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

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

What are Loop Actions?

Image Removed

Advanced Actionflow Settings

Additional options can be found in the Advanced section of certain action node 

Insert excerpt
_actionproperty_loopsettings
_action_loopnameloopproperty_settings
nopaneltrue
 and in the Properties for the Actionflow itself, as specified below.

Allow Parallel Runs from One Client

This setting is available in the

Insert excerpt
_property_settings
_property_settings
nopaneltrue
 actions repeat an action or set of actions multiple times. 

In PhixFlow, there are three types of supported looping:

Polling

Repeats the same operation multiple times with the same parameters, until a desired result is obtained.

  • Generates a single output record
    • Output results are only generated at the end of the iterations
  • Example: polling a HTTP API until the results are available

Start Loop and End Loop

Loops consist of a

 for the Actionflow.

When enabled, allows an Actionflow to be run multiple times in parallel from the same client, i.e. another run can be started while the previous run is still being processed. This option is disabled by default.

Image Added

Prioritise Throughput Over Ordering

This setting is available in the

Insert excerpt
_property_settings
_property_settings
nopaneltrue
 for the Actionflow and the action nodes, as specified below.

When enabled, records are processed in parallel to optimise performance. This means the order records are processed is nondeterministic.

Image Added

When disabled (default), records are processed in the order they are provided.

This option is available on the following actions:

Section


Column
  • Insert excerpt
    _
action
  • run_
loop
  • analysis_
start
  • icon
    _
action
  • run_
loop
  • analysis_
start
  • icon
    nopaneltrue
     
and an 
  • Analysis
  • Insert excerpt
    _action_
loop
  • bulk_
end
  • delete
    _action_
loop
  • bulk_
end
  • delete
    nopaneltrue
,joined by a loop connector which returns the result of the End node back to the Start node. The Start and End Loop each have their own properties.On the 
  • Insert excerpt
    _action_
loop_end
  • bulkupdate
    _action_
loop_end
  • bulkupdate
    nopaneltrue
, the Records to output can be set, either outputting All Records from the loop or just the Final Record. The icon on the end loop node shows which option is set.

Image Removed

Loop Mappings

Attributes passed into a loop are available as passthrough, as well as attributes mapped in from the End Loop. This allows the original passthrough values to be referenced and if the loop is manipulating the incoming attributes, for example, incrementing a number, this is also available.

The mapped attributes that are manipulated by the loop are shown with a loop icon on the Mappings window, and passthrough attributes are shown with the icon of where they have come from, for example, a
  • Insert excerpt
    _action_calculate
    _action_calculate
    nopaneltrue
  • Insert excerpt
    _action_
calculate
  • converge
    _action_
calculateClick and drag the 
  • converge
    nopaneltrue
 action.

Image Removed

Tip

Loops wait until all their internal nodes have completed their tasks before beginning the next iteration of the loop.

Creating Loop Actions

  • Insert excerpt
    _delete
    _delete
    nopaneltrue
  • Insert excerpt
    _action_
loop
  • email
    _action_
loopnameloop
  • email
    nopaneltrue
 icon from the toolbar onto the canvas
  • In the Create Loop Action window:
    1. Enter a Name
    2. Select Create Action
  • Map attributes from other actions to the 


    Column
    • Insert excerpt
      _action_for_each
      _action_for_each
      nopaneltrue
    • Insert excerpt
      _action_
    loop_start
    • gateway
      _action_
    loop_startOn the 
    • gateway
      nopaneltrue
    to be processed by the loop
    • Insert excerpt
      _action_
    loop_end
    • http
      _action_
    loop_end
    • http
      nopaneltrue
    , set:
    1. Records to output: Choose whether to output all records from the loop or just the final record
    2. Until Expression: An expression that is checked on each cycle of the loop, and once the expression returns true, the loop will end
      1. Example: in.myValue == 10
    3. Max Loops: This is a safety net designed to stop infinite loops. After the number of loops set here, the loops will stop
      1.  This default to 10000

    Worked Example

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

    In this example, we are using:  

    • Company Bank Holiday API - Loops screen containing a grid backed by an empty Bank_Holiday_Results table, drop down fields for the user to select the Year From and Year To values and a Run button - this screen was created using the Tile no Buttons 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 Advanced Application. For this example, we'll be working on the Company Bank Holiday API - Loops screen.

    Loop Through Selected Years and Return Bank Holidays

    In this example, a user selects two year parameters to obtains the UK bank holidays for. We'll create an Actionflow that takes in these two parameters and loops through each year. For the purposes of this example, our Actionflow will call an API that exists within PhixFlow but this API represents an external API.

    Image Removed

    Obtain the API URL

    We have provided an Actionflow that acts as a UK Bank Holiday API. This can be called by a Actionflow, in the same way that an external API can be called. The UK Bank Holiday API has been configured to receive a year parameter and use that parameter to pass out the bank holiday dates for the corresponding year.

    See 3.01 Setting up an API End Point for more details on how this API has been setup or to set one up yourself.

  • Search for the Bank Holiday API Actionflow on the Actionflow page
    1. Image Removed
  • Open the Actionflow Insert excerpt_property_settings_property_settingsnopaneltrue and in the API section, copy the URL and save it locally to be used later

    Actionflow Setup

    Create an Actionflow using a
    • Insert excerpt
      _action_json
      _action_json
      nopaneltrue
    • Insert excerpt
      _action_save
      _action_save
      nopaneltrue
    • Insert excerpt
      _action_xml
      _action_xml
      nopaneltrue



    Advanced Settings - Action Node Specific

    Insert excerpt
    Bulk Delete Action Configuration
    Bulk Delete Action Configuration
    nameBatchSize
    nopaneltrue

    Connection Timeout (s)

    On the 

    Insert excerpt
    _action_http
    _action_http
    nopaneltrue
     action, in the Advanced section, a maximum time to wait while attempting to create a connection can be set, measured in seconds. The default is 300 seconds.

    Response Packet Timeout (s)

    On the 

    Insert excerpt
    _action_

    loop

    http
    _action_

    loopname

    http

    actionSelect the Year From and Year To criteria and press Run

    nopaneltrue

     to poll the API and retrieve the bank holidays for the years selected on the Company Bank Holidays API - Loops screen.
    1. Open the Company Bank Holidays API - Loops screen
    2. Add an Actionflow to the Run button
      1. Name: Get Bank Holidays

    Testing

  • Close all screens and reopen the Company Bank Holidays API - Loops screen
  •  action, in the Advanced section, a maximum time to wait between responses from the data packets can be set, measured in seconds. The default is 180 seconds.


    Image Modified