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.

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 syntax [<FieldName>].

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

NOTE: If the company administrator has renamed fields, the record type Fields list shows the new names, but the expression syntax shows the original names. For custom fields, the Integration Tag names that the company administrators can change are used in the expression syntax. The syntax is as follows:

[<CustomTag_ITAG>] and FieldValue('<CustomTag_ITAG>')

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 5/4/2012 Copyright © 2005, 2012, Oracle. All rights reserved. Legal Notices.