Reporting with Actions

Since Actions are ideal for advanced data transformations it makes sense to use them in connection with the integrated Reporting functionality in Perfion.

Overview & Behaviour

By default, the report starts as normal by prompting a report dialog for user input (e.g. Language and possibly custom defined parameters etc.). Based on the queries defined in the SuperQuery and the chosen parameter values, all the data for a report is retrieved and output together.
When the data is ready, the report then redirects all of its data and user input to an Action, and the Action takes over from there.

Reporting to an Action

All you have to do is add a couple of attributes to the reporting SuperQuery, as shown below.

<SuperQuery actionID='1226' actionData='ContextOnly' actionExecution='silent'> <Query> ...

If you want to redirect a report to call an Action, you only have to include the above attribute actionID and assign it the unique Perfion Item ID of the Action in Perfion.
How reporting executes depends on the existence and values of some of the other action related attributes as described in the following table.

SuperQuery Action Attributes

actionID

The unique Perfion ID of the Action to execute when running the report.
Example: actionID='1226'

actionData

By default, all reporting data is retrieved and passed to the Action.
However, if you want an Action to take over the data generation completely, you can alter the behavior of the Report to only gather and pass the context of the Report (i.e. the item that the report was started from and the user input from the dialog).
This is done by setting the actionData attribute as follows: actionData='ContextOnly'.

ContextOnly will supress the Row, Features and Parameters Data Sources.

actionExecution

Defines whether the Action debugger should be opened or not.
The default behavior is to open the debugger, but when you are done creating the Action and it works as intended you may want to supress this dialog. To do this specify actionExecution='silent'

execute

This is not specific to Actions, but some of your Actions may benefit from it.
By default the user input-dialog is always shown. But you can disable this if you want to run the report as-is without any user interaction by setting this attribute as follows: execute='view'

Executing the Report

When executing the report with the Action-debugger, you will get an Action started with the following 3 Data Sources

  • Row: Contains all the data from the Catalog and Items (if started from the structure on the left side, otherwise it will only contain data from the Items).

  • Features: Contains all metadata about the features

  • Parameters: Contains the values chosen by the user on the User Dialog, i.e. both standard and customer parameter values.

Furthermore, a few variables are initialized with e.g. the Perfion ID of the Items from where the report was started.

Note! Using actionData='ContextOnly' will supress the Row, Features and Parameters data sources. You will only receive Variables in the Action including the Context (hence the name) of the Items the report was generated from.

Report Action Execution Window

The above execution window was generated with the following SuperQuery:

<SuperQuery actionID="11012"> <Query> <Select languages="EN" view="Virtual,Normal"> <Feature id="*" view="Config" /> </Select> <From id="100" /> </Query> </SuperQuery>

where 11012 is the Perfion ID of the Action I am sending the report data to. To find the Perfion ID, choose ‘…Open Item’ from the right click menu of the Action in the categoriser \ leftside.

Basis of a report-action

Advantages of Reporting to Actions

Since it is possible to manipulate all the data from the Report with an Action, this makes it possible to do things like:

  • Map and alter the names of the columns in the Output, to match any existing templates

  • Add new columns with special values that may not exist in Perfion

  • Manipulate the data in the output (e.g. use Description1 if it exists, otherwise use Description2)

  • Generate the Export as an Excel-file instead of Xml. This should make EasyCatalog work better and e.g. be able to automatically add new columns from the output.

  • Use the Action functionality to get complete control of Image sizing, formats, fitting, background colors, file-naming etc.

  • Significantly faster Image and File exports / updates, as files are only exported if they have actually been updated since the last export saving a lot of time (by matching filename and time-stamp).

Note you may be able to achieve all you need to in the Action by executing Actions in Context instead of using Report-Actions, which will also send the Context Items to the Action without requiring an associated report.