Print      Open PDF Version of Online Help


Previous Topic

Next Topic

Data Types in Expression Builder

This topic describes the data types in Oracle CRM On Demand, and how they are used in Expression Builder.

NOTE: The language-independent field names and the field-name syntax used in any example expressions in this topic are the field names and the field-name syntax that were used in Expression Builder in releases earlier than Release 29 Service Pack 1. These examples are still valid. However, if you select the corresponding fields for an expression from the Fields list in Expression Builder in Release 29 Service Pack 1 or later, then the field names and the field-name syntax will be different from those shown in the examples. It is recommended that you always select the fields for your expressions from the Fields list in Expression Builder, so that the field names and the field-name syntax are always correct. For more information about the field names and the field-name syntax in expressions, see About Expressions.

Data Types in Oracle CRM On Demand

The following table shows the data type returned when an Oracle CRM On Demand field is used in an expression. To get the value of a field, use the [{FieldName}] syntax or the [<FieldName>] syntax.

Oracle CRM On Demand Field Type

Return Type in Expressions

Integer

Integer

Picklist

String

Currency

Currency

ID

String

Text

String

Check box

Boolean.

For example, you can use [<Active>] directly in places where conditions are expected. You can also use FieldValue('<Active>') = 'Y'.

Date

Date

Date Time

Date Time

Number

Number

Data Type Arithmetic

When a statement references more than one field value, and the fields have different data types, the order of the data types can affect the calculation. When an operator (other than the exponent operator) is applied to two operands of two different data types, the operand on the right side of the operator is converted to the data type of the operand on the left side before the operation is evaluated. For example, if CloseDate is 02/09/2007, the following expression:

PRE('<CloseDate>') + 30

evaluates to 02/09/200730. Therefore, the following condition:

[<CloseDate>] > PRE('<CloseDate>') + 30

is syntactically valid, but its meaning is invalid. The condition is correctly written as follows:

[<CloseDate>] - 30 > PRE('<CloseDate>').

NOTE: When the exponent operator is used, the operand on the right side of the operator is not converted to the data type of the operand on the left side.

The following tables show the possible results of the various arithmetic operations, using the example values.

Field

Data Type

Example Value

Quantity

Integer

5

Item Price

Currency

2.25

Calculation

 

Result

Value

Data Type

[<Item Price>] + [<Quantity>]

7.25

Currency

[<Quantity>] + [<Item Price>]

7

Integer

[<Item Price>] - [<Quantity>]

(2.75)

NOTE: For currency fields, parentheses indicate that the value is negative.

Currency

[<Quantity>] - [<Item Price>]

3

Integer

[<Item Price>] * [<Quantity>]

11.25

Currency

[<Quantity>] * [<Item Price>]

10

Integer

[<Item Price>] / [<Quantity>]

0.45

Currency

[<Quantity>] / [<Item Price>]

2.50

Currency

When the exponent operator is used, the operand on the right side of the operator is not converted to the data type of the operand on the left side.

In this example (where Quantity is an integer field, value 5, and Item Price is a currency field, value 2.25), if the operand on the right side of the operator was converted to the data type of the operand on the left side, the expected value of Quantity ^ Item Price would be 25, and the expected data type would be integer. However, the results are shown in the following table.

Calculation

 

Result

Value

Data Type

[<Item Price>] ^ [<Quantity>]

57.67

Currency

[<Quantity>] ^ [<Item Price>]

37.38

Currency

The negation operator (minus sign [-]) is also supported in Expression Builder. For example:

Calculation

 

Result

Value

Data Type

-1 * [<ItemPrice>]

(2.25)

Currency

If you convert a number to a string, the calculation does not work correctly. For example:

Calculation

 

Result

Description

 

Value

Data Type

1234 + abcd

1234

Number

The string "abcd" evaluates to the number 0 and is then added to 1234.

abcd + 1234

abcd1234

String

The number 1234 evaluates to the string "1234" and is appended to the string "abcd".

Related Topics

See the following topics for related Expression Builder information:


Published 7/6/2017 Copyright © 2005, 2017, Oracle. All rights reserved. Legal Notices.