Create_a_Custom_Expression

Alchemex 7.1

Home > Tutorials > Connector Tutorial > Add a Data Expression > Creating a Custom Expression

Creating a Custom Expression

Overview

There are times that a data field in the database does not provide the data needed by the report writer. The Connector enables you to use either SQL statements or Microsoft Excel statements to create custom expressions.

The current data expressions do not provide a combined sales and sales tax value. For our report we require the combined totals of sales value and sales tax. This can be achieved using an SQL expression. Complete the exercise below to create this custom expression.

Exercise 1: Creating an SQL Expression

Follow the step-by-step guide to create a SQL expression that adds the sales value and the sales tax value to create a combined total.

  1. Ensure that the Customer Documents container is open.
  2. Copy and paste the TotalExcl expression to the Customer Documents container.
  3. Rename the new expression TotalIncl.
  4. In the Property window, select the Expression Type field and change the expression type to SQL expression.
  5. Click Apply. The SQL expression property window is displayed.
  6. Highlight the contents of the Expression Source property and enter the following expression: [DocumentHeader].[TotalExcl]+[DocumentHeader].[TotalTax]

  7. Click Apply.
  8. Ensure the expression is correct by sampling the data. (Right-click > Sample Data) The sample data screen displays the combined total.
Next-->