2.16 Analysis Action Configuration
What is an Analysis Action?
An
Analysis actions only allow tables with a Period of Transactional to be included to ensure correct model operation.
Creating Analysis Actions
Click and drag the
Analysis action icon from the toolbar onto the canvasEnter a name for the Analysis action, then select Create Action
In the Analysis action
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 RepositoryDrag 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.
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
Actionflow Setup
On the Shop Stock screen, add an Actionflow to the
icon
Set the Input to
Add a
action to the canvas and connect thenode to itOn the Calculate action, add two Output Attributes:
Name:
distributionCentreIDType:
IntegerExpression:
1001
Name:
distributionCentreType:
StringExpression:
"North"
Add a
action to the canvasOn its Properties, in the Tables section, click the
iconDrag across the Shop_Stock_Additional_Processed table from the Repository to the Analysis action properties
Connect the Calculate action to the Analysis action and map across both attributes
Click on the Analysis action to view these two attributes in the Input Parameters
Table Attributes Setup
On the Analysis Model, Actionflow Intermediate Data, click on the table, Shop_Stock_Additional_Processed
Double-click on the attribute, distributionCentreID, and change the Expression to
_context.distributionCentreIDThis is then referring to the attribute setup on the Calculate action
Make the same change for the attribute, distributionCentre, so it too is referring to the attribute set on the Calculate action
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)
On the Actionflow, create a
action with the Primary Table, Shop_Stock_Additional_Processed, and connect the Analysis action to the View actionIn its Properties, in the Data Retrieval Options section, set the Data Range to Latest
This will ensure that this data isn't continuously added if the Actionflow is run repeatedly
For the Output Attributes section, click the
icon and drag across all attributes
Create a
action to save the data to the Shop_Stock_Processed tableIn its Properties, in the Basic Settings section, set the Type to Insert and
toggle on Auto Save Attributes
Connect the View to the Save action and map across all attributes
On the Shop Stock screen, run the Actionflow by pressing
Import New Stock
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.