Creating a custom expression
An expression is a statement that produces a value. An expression can be a literal value, such as:
1.23
"Hello, World!"
An expression can contain any combination of literal values, operators, functions, and references to data fields, as shown in the following examples. For detailed descriptions of the functions that Interactive Viewer supports, refer to a later section of this document.
The following expression displays a customer’s first and last names, which the database entry stores in two fields. The & operator concatenates string values.
[FirstName] & [LastName]
The following expression displays a full address by concatenating values from four data fields and adding commas as appropriate:
[Address1] & ", " & [City] & ", " & [State] & " " & [Zipcode]
The following expression calculates a gain or loss percentage. The expression uses the mathematical subtraction, division, and multiplication operators, ‑, /, and *.
([SalePrice] ‑ [UnitPrice])/[UnitPrice] * 100
The following expression uses the DIFF_DAY function to calculate the number of days it took to process an order for shipping:
DIFF_DAY([OrderDate], [ShippedDate])
The following expression uses the ADD_DAY function to calculate a payment due date when the payment term is net 30:
ADD_DAY([InvoiceDate], 30)
The following expression uses the IF function to evaluate if the value in the country column is UK. If the condition is true, the function replaces the value with United Kingdom. If the condition is false, the country values are displayed as stored.
IF(([Country]="UK"),"United Kingdom",[Country])