Writing expressions
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.
The following expression displays a customer’s first and last names which are stored 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 where appropriate:
[Address1] & ", " & [City] & ", " & [State] & " " & [Zipcode]
The following expression calculates a gain or loss in percent. The expression uses the 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. The function takes two arguments, a start date and an end date. In the example, two data fields are supplied as the arguments. BIRT Studio runs this expression against each value in the fields and calculates a value for each data row:
DIFF_DAY([OrderDate], [ShippedDate])
The following expression uses the ADD_DAY( ) function to calculate a payment due date when the payment term is 30 days from the date of the invoice. The function takes two arguments, a start date and the number of days to add:
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 appear as stored:
IF(([Country]="UK"),"United Kingdom",[Country])

Additional Links:

© Copyright OpenText Corp. All rights reserved. Privacy Policy | Cookie Policy

BIRT iHub 2