Data types

From Genesys Documentation
Jump to: navigation, search
This topic is part of the manual Field Codes Reference Guide for version Current of Routing.

Learn about the data types you can use in field codes.

Related documentation:

Field codes can use the data types detailed on this page.

Number

You use numbers in field code formulas in much the same way you would in other applications, such as Microsoft Excel. All arithmetic calculations are performed internally using floating point arithmetic (with the decimal point). Rounding occurs only during formatting.

When you write numbers in formulas, you can use scientific notation (for example, 12.34e-2 is the same as 0.1234).

The Operators table lists the operators that you can use with numbers. Some rows show more than one symbol for the same operator. In these cases, the symbols are synonyms.

Operators
Operator Description Example Result
- Unary Minus -4 -4
^ Exponentiation 2^3 8
* Multiplication 2*3 6
/ Division 8/2 4
Mod Modulus (Remainder) 14 Mod 5 4
+ Addition 2 + 3 5
- Subtraction 2 – 3 -1
> GT Greater Than 2 > 3 False
>= GE Greater Than or Equal To 2 >= 2 True
< LT Less Than 2 < 3 True
<= LE Less Than or Equal To 2 <= 3 True
= == EQ Equal To 2 = 3 False
<> != NE Not Equal To 2 <> 3 True
: Format 2 : “#.##” 2.00

String

Use the String data type to represent textual data. When you write a string in a formula, you must enclose it in double quotation marks. For example:

"The sixth sheik's sixth sheep's sick."

You can use the escape sequences shown in the Escape Sequences table to include special characters in a string, such as tabs or carriage returns.

It is also possible to use HTML tags in field codes.

Escape Sequences
Escape Translates to
\a Alert (Bell)
\b Backspace
\f Form Feed
\n Line Feed (Newline)
\r Carriage Return
\t Horizontal Tab
\v Vertical Tab
\' Single Quotation Mark
\" Double Quotation Mark
\\ Backslash

The Operators and Strings table lists the operators that you can use with strings. All the comparison operators are case insensitive. Some rows show more than one symbol for the same operator. In these cases, the symbols are synonyms.

Operators and Strings
Symbol Meaning Example Result
+ Concatenation "How" + "die" "Howdie"
>GT Greater Than "A" > "B" False
>=GE Greater Than or Equal To "A" >= "B" False
<LT Less Than "A" < "B" True
<=LE Less Than or Equal To "A" <= "a" True
= ==EQ Equal To "A" = "a" True
<> != NE Not Equal To "A" NE "B" True

Date and time

Date/Time values in field code formulas represent specific moments (for example, February 3, 2002, at 10:03:55 AM). The most common operations performed on Date/Times are comparisons (for example, <, =, and so on).

If you subtract two Date/Time values, the result is the number of days between them. See the Date/Time Example 1 table for examples.

Date/Time Example 1
Formula Result
Date(2002, 11, 23) – Date(2002, 11, 22) 1
Date(2002, 11, 22) – Date(2002, 11, 23) -1
Date(2002, 11, 23) – Date(2002, 11, 23, 12) -0.5

If you add (or subtract) a number to (from) a Date/Time, the result is the Date/Time moved forward (or backward) by that many days. See the Date/Time Example 2 table for examples.

Date/Time Example 2
Formula Result
Date(2003, 11, 23) + 1 2003-11-24 00:00:00
Date(2003, 11, 23) – 0.5 2003-11-22 12:00:00

Boolean

Set Boolean values in field code formulas to either True or False. You can use the True and False keywords to write a Boolean value explicitly, although this is rarely required. Comparison operators (for example, <, =, and so on) always yield Boolean results.

The Operators and Booleans table lists the operators that you can use with Booleans. Some rows show more than one symbol for the same operator. In these cases, the symbols are synonyms.

Operators and Booleans
Symbol Meaning Example Result
Not ! Unary Not Not False Not True True False
And &&
Logical And False And False False And True True And False True And True False False False True
Or {{!}}{{!}} Logical Or False Or False False Or True True Or False True Or True False True True True
XOr Logical Exclusive Or False XOr False False XOr True True XOr False True XOr True False True True False
= == EQ Equal To True = False False
<> != NE Not Equal To True <> False True
Retrieved from "https://all.docs.genesys.com/PEC-ROU/Current/FldCod/DatTyp (2022-01-24 09:48:44)"