Skip to main content

How to create custom column

While the module already defines numerous columns with typical calculations, custom columns are useful when using unique formulas or non-typical data combinations.

  1. To create a custom column, visit Reports -> Advanced Reports -> Config Builder and press the Add New Config button.
  2. The config Workspace consists of two required fields - Title and XML Config.
  3. Enter a value for the Title field. This name is for internal use only to navigate through the configs list.
  4. In the XML Config field, define a column as XML document. The details on the structure of the XML config are provided here.
  5. Click on the Save button.
  6. Clean the cache.
  7. To verify the configuration, navigate to the reports section by following Reports -> Advanced Reports -> Reports. Any common syntax errors will be immediately displayed as error messages.

Here is an example of custom column that calculates the Gross Profit based on the actual invoiced orders. More useful examples could be found in the relevant section of the manual.

<config>
<table name="sales_order" group="Sales" label="Orders">
<column name="custom_gross_profit"
label="Custom Gross Profit"
fields="base_subtotal_invoiced,base_total_invoiced_cost,base_total_refunded,base_to_global_rate"
type="money"
expr="(%1 - IFNULL(%2, 0) - IFNULL(%3, 0)) * %4" />
</table>
</config>