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. |
actionData | By default, all reporting data is retrieved and passed to the Action. ContextOnly will supress the Row, Features and Parameters Data Sources. |
actionExecution | Defines whether the Action debugger should be opened or not. |
execute | This is not specific to Actions, but some of your Actions may benefit from it. |
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.
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.
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.