Analysis Action Configuration

What is an Analysis Action?

An  Analysis action runs analysis on tables. For more information about running tables, see Analysis Models

Analysis actions only allow tables with a Period of Transactional to be included to ensure correct model operation.

Creating Analysis Actions

  1. Click and drag the  Analysis action icon from the toolbar onto the canvas
  2. Enter a name for the Analysis action, then select Create Action
  3. In the Analysis action  Properties on the right, populate the following details, as required

Tables

Add tables to this list to run analysis on when the Actionflow is triggered. Analysis is ran simultaneously on all tables in this list.

  • To add a table, in the Tables section click the  icon to open a list of tables for the application in the Repository
  • Drag a table from the list into the Tables section

Input Parameters & _Context 

Attributes mapped into Analysis actions can be used in the attribute expressions on the table using the internal variable _context, e.g._context.AttributeName.

To do this, add attributes to the Input Parameters section of the Analysis action properties using the same name as in the Expression for the attribute on the table. 

For example, if a table relies on the expression '_context.Name', an attribute called 'Name' can be added to the Analysis action. The value for this can then be mapped to this attribute from any preceding connection.

Example Uses

If your table contains a Last Updated attribute, you can use Input Parameters and the _context variable to map an Output Attribute containing the expression now or today from a Calculate action onto the Input Parameters on the Analysis action, and then into the table using the _context variable.

Advanced

When an Analysis action is used in an Actionflow, the records are processed in parallel. While we can control the order records exit an Analysis action, we cannot control the order they are processed.

 Tick Prioritise Throughput Over Ordering to process records in parallel to optimise performance. This means the order records are processed is nondeterministic.

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

Worked Example

Here is 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 these example, we'll be working on the Shop Stock screen

Import Bulk Stock

In this example, we'll set up an Actionflow that runs analysis on a table importing a bulk stock delivery and we'll map values into this data. As an optional process, we'll combine this bulk stock delivery with our existing stock and display this on the Shop Stock screen. 

Review Tables

  1. Open the Analysis Model, Actionflow Intermediate Data
  2. Click on the tables to review the data
    1. The Shop_Stock_Processed table contains the data on your Shop Stock screen and ERD
    2. The Shop_Stock_Additional_Processed table represents a new delivery of stock into your warehouse and requires combining into main stock data
      1. This is the table we will run analysis on as part of this example
      1. Note that this table has a Period of Transactional, which will allow us to run analysis on it via the Actionflow

Actionflow Setup

  1. On the Shop Stock screen, add an Actionflow to the  icon
  2. Set the Input to   On Click
  3. Add a  Calculate action to the canvas and connect the  input node to it
  4. On the Calculate action, add two Output Attributes:
    1. Name: distributionCentreID
      1. Type: Integer
      2. Expression: 1001
    2. Name: distributionCentre
      1. Type: String
      2. Expression: "North"
  5. Add a  Run Analysis action to the canvas
  6. On its Properties, in the Tables section, click the  icon
    1. Drag across the Shop_Stock_Additional_Processed table from the Repository to the Analysis action properties
  7. Connect the Calculate action to the Analysis action and map across both attributes
    1. Click on the Analysis action to view these two attributes in the Input Parameters

Table Attributes Setup

  1. On the Analysis Model, Actionflow Intermediate Data, click on the table, Shop_Stock_Additional_Processed
  2. Double-click on the attribute, distributionCentreID, and change the Expression to _context.distributionCentreID
    1. This is then referring to the attribute setup on the Calculate action
  3. Make the same change for the attribute, distributionCentre, so it too is referring to the attribute set on the Calculate action
  4. Save the Analysis Model

At this point, you can run the Actionflow and see the results of the Actionflow in the Shop_Stock_Additional_Processed table, which will now contain 50 records, along with the values for Distribution Centre ID and Distribution Centre as set in the Calculate action.

Optionally, follow the additional steps below to combine the new stock data with our existing stock data and display it on the Shop Stock screen.

Combine Data & Display (Optional)

  1. On the Actionflow, create a   View action with the Primary Table, Shop_Stock_Additional_Processed, and connect the Analysis action to the View action
    1. In its Properties, in the Data Retrieval Options section, set the Data Range to Latest
      1. This will ensure that this data isn't continuously added if the Actionflow is run repeatedly
    2. For the Output Attributes section, click the  icon and drag across all attributes
  2. Create a  Save action to save the data to the Shop_Stock_Processed table
    1. In its Properties, in the Basic Settings section, set the Type to Insert and  toggle on Auto Save Attributes
  3. Connect the View to the Save action and map across all attributes
  4.  Checkpoint

  5. On the Shop Stock screen, run the Actionflow by pressing  Import New Stock
  6. The additional 50 records will be added to the Available Stock grid


If you go wrong at any point and alter your data in an unexpected way, you can roll back your training data to its original state - see Rolling Back Test Data.