Sei sulla pagina 1di 11

Expression Builder Operators

This table describes the operators available for building business rules, filters, and logical expressions or
conditional statements in the Expression Builder dialog.

When you create an expression statement, if you construct the expression to return as TRUE (1), you can
then easily drill down to see the Rows that failed.

Operator

Meaning

Arithmetic
-

Subtract

Multiply

Divide

Add

Comparison
<

Less Than

<=

Less Than or Equal To

<>

Not Equal To

Is Equal To

>

Greater Than

>=

Greater Than or Equal To

Logical

A conjunction between two statements (not case-sensitive).


AND

A conjunction is TRUE if, but only if, both of its statements are TRUE.
Example

Logical condition operators. ELSE statement is optional.


IF, THEN, ELSE

IF expression1 THEN expression2 ELSE expression3|TRUE|FALSE


Example

IF, THEN, ELSE IF,


THEN, ELSE

Logical condition operators. Syntax is similar to the IF, THEN, ELSE logical statement.
IF expression1 THEN expression2 ELSE IF expression3 THEN

Operator

Meaning
expression4 ELSE expression5|TRUE|FALSE
Example

Reverses the Truth value of the statement that follows (not case-sensitive).
NOT

Example

An inclusive disjunction between two statements (not case-sensitive).


The disjunction is TRUE if either, or both, of the statements are TRUE.
Example
OR

This expression validates that if the Sort Code field is populated, then it is
correct for the country in the Client field.
[Sort Code] = ""
OR (PATTERN([Sort Code],"default") LIKE "d9" AND Client LIKE
"US*")
OR (PATTERN([Sort Code],"default") LIKE "d2pd2pd2" AND Client LIKE
"A*")

Set

Allows you to test if a value is equal to one of a list of values.


source_op IN (n1,n2nx)
Example
IN

You can create validation and business rules based on whether a value is equal to one of
a list of values.
IF [apt_num] IN (2??) THEN
ELSE IF [apt_num] IN (3??,4??,5??) THEN
In this next example, the source operand (the result of finding the "default" pattern for a
Sort Code value) is tested against the expected pattern for that value.
PATTERN([Sort Code],"default") LIKE "d9"

Like

Comparison operator that allows you to look for a string that matches a certain pattern.
You may use wildcard characters (* or ?) to broaden match criteria.
source_op LIKE "string"
LIKE

Example
This example shows how to view all values in the NAME Attribute that contain the string
"cust".
NAME LIKE "cust"
To find all Product identification numbers with a 5 in the 3rd position, you would build an
expression similar to this:

Operator

Meaning
Product_Id LIKE "??5*"

Expression Builder Functions


This table describes the functions available for building business rules, data filters, and logical expressions
(conditional statements) in the Expression Builder dialog. All values are case-sensitive.

When you create an expression statement, if you construct the expression to return as TRUE (1), you can
then easily drill down to see the Rows that failed.
Click the

icon to view additional syntax descriptions and examples.

Function

Description

Date/Time Functions

Returns the specified date as seconds. This command parses and converts any
standard date or time string. If you specify only the time, the function uses the current
date as the default.
DATE_TO_SECONDS

DATE_TO_SECONDS(DateString)
where DateString is a string that contains the time and optional month/day/year date.
Example
DATE_TO_SECONDS(15:54 12/14/05) returns 1134575640.
Returns the specified date, given as day/month/year, in seconds.
DAYMONTHYEAR(DateString)
where DateString is a string that contains the day/month/year date.

DAYMONTHYEAR

Examples
DAYMONTHYEAR(20/12/05) returns 1135036800.
DAYMONTHYEAR(12-12-05) returns 1134345600.
If you typed DAYMONTHYEAR(2005-20-12), you receive the error Invalid date
format.
Returns the specified date, given as month/day/year, in seconds.
MONTHDAYYEAR(DateString)
where DateString is a string that contains the month/day/year date.

MONTHDAYYEAR

Examples
MONTHDAYYEAR(12-12-05) returns 1134345600.
MONTHDAYYEAR(12/12-05) returns 1134345600.
If you typed MONTHDAYYEAR(2005-14-12), you receive the error Invalid date
format.

NOW

Returns the current date and time as seconds.


NOW()

Function

Description
Example
If it is December 14, 2005, the function NOW() returns 1134575640.
Returns the number of seconds in a given time period. Use this function to get the
number of seconds in a specified number of days, weeks, and so forth.
SECONDS_IN(TimePeriod)
where TimePeriod is a string that indicates the number of hours, days, weeks, months,
and so forth.

SECONDS_IN

Use these units to specify the time period: year, fortnight, month, week, day, hour,
minute (or min), second (or sec). You may also specify these time modifiers:
tomorrow, yesterday, today, now, last, this, next, ago.
Examples
SECONDS_IN(1 day) returns 86400.
SECONDS_IN(2 weeks) returns 1209600.
Converts given seconds to the specified date/time format. Field descriptors consist of a
% followed by a field descriptor character. All other characters are copied into the result.
SECONDS_TO_DATE(Seconds,Format)
where:
Seconds is the number of seconds to convert.

SECONDS_TO_DATE

Format is a string of one or more field descriptors that indicate


the format to use.
Example
SECONDS_TO_DATE(1133312345,%a %b %d %H:%M:%S %Z %Y) returns Wed
Nov 30 00:59:05 GMT 2005.
Click here for a list of SECONDS_TO_DATE field descriptors.
Returns the specified YEAR DAY MONTH date as seconds.
YEARDAYMONTH(DateString)
where DateString is the date you want to convert to seconds.

YEARDAYMONTH

Examples
YEARDAYMONTH(05/14-12) returns 1134518400.
YEARDAYMONTH(5/1/1) returns 1104537600.
YEARDAYMONTH(2005/01/01) returns 1104537600.
Returns the specified YEAR MONTH DAY date as seconds.
YEARMONTHDAY(DateString)

YEARMONTHDAY

where DateString is the date you want to convert to seconds.


Examples
YEARMONTHDAY(2005-12-01) returns 1133395200.
YEARMONTHDAY(5/12/1) returns 1133395200.

Function

Description

Numeric Functions

Returns the absolute value of a number.


ABS

ABS(Number)
where Number is the number for which you want the absolute value.
For example, ABS(-1.123) returns the value 1.123.
Rounds a decimal number up to the nearest larger integer.

CEILING

CEILING(Number)
where Number is the decimal number you want to round up.
For example, CEILING(1.123) returns 2.0.
Rounds a decimal number down to the nearest smaller integer.

FLOOR

FLOOR(Number)
where Number is the decimal number you want to round down.
For example, FLOOR(1.123) returns 1.0.
Returns the decimal remainder of the division of Number1 by Number2.
MOD(Number1,Number2)

MOD

where:
Number1 is the number to be divided.
Number2 is the number by which Number1 is divided.
For example, MOD(94,9) returns the remainder 4.0.
Returns the percentage that Number2 is of Number1.
PERCENT(Number1,Number2)

PERCENT

where:
Number1 is the number used to calculate the percentage of Number2 in Number1.
Number2 is the number divided into Number1 to calculate the percentage that
Number2is of Number1.
For example, PERCENT(48,12) returns the percentage 25.0.
Calculates the values of Number1 raised to the power of Number2.
POWER(Number1,Number2)

POWER

where:
Number1 is the number you want to calculate the power of.
Number2 specifies the power to use in the calculation.
For example, the function POWER(4,4) returns 256.0.

ROUND

Rounds a decimal number to its nearest integer.

Function

Description
ROUND(Number)

Returns the square root of a number,


SQUARE_ROOT

SQUARE_ROOT(Number)
where Number is the number for which you want the square root.
For example, the function SQUARE_ROOT(81) returns 9.0.
Returns a number formatted to n decimal places with a localized decimal point.
TO_CHAR(Number,Precision)
where:

TO_CHAR

Number is the number for which you want the absolute value.
Precision is the number of decimal places to use.
Example
TO_CHAR(1,23456) returns 1.2345 or in German locale 1,2345.

String Functions

Appends arguments (such as strings, attributes,and integers) together with a space


between each argument.
APPEND(Argument1,Argument2,Argument3)
APPEND

where:
Argument1 indicates the first argument in a series of appended arguments.
Argument2 indicates the second argument in a series.
Argument3 indicates the third argument, and so forth.
Concatenates two string values into a single string.

CONCAT

CONCAT(String1,String2)
where String1 and String2 are the two string values to be joined into one string.
Returns the character length of the string.

LENGTH

LENGTH(String)
where String is the value on which the character length gets returned.
Returns the string converted to lowercase.

LOWER

LOWER(String)
where String is the value that will be converted to all lowercase characters.

LTRIM

Trims the leading (left-side) white space.


LTRIM(String)

Function

Description
where String is the value on which any leading white space characters will be
removed. White space characters are spaces, tabs, new lines, carriage returns, and
form feeds.
Applies regular expressions to a string.
REGEXP("Expression","String")

REGEXP

where:
Expression is the expression you want to use.
String is the string to which you want to apply the expression.
For example, the function REGEXP("(ab|a)c","zabcdefgh") returns "abc".
Trims the trailing (right-side) white space.

RTRIM

RTRIM(String)
where String is the value on which any trailing white space characters will be
removed. White space characters are spaces, tabs, new lines, carriage returns, and
form feeds.
Replaces all instances of FindString with ReplaceString in the specified

InputString.
SUBSTITUTE("InputString", "FindString", "ReplaceString")
SUBSTITUTE

where:
InputString is the target string in which text is replaced.
FindString is the text to find so that it can be replaced.
ReplaceString is the text you want to replace it with.
For example, the function SUBSTITUTE ("substitute test", "te", "xx")
returns "substitute xxst".
Returns a substring.
SUBSTR(String,Start,Length)
where:
String is the value to use to create the substring.
Start is a number that indicates the position of the character in the string that will
become the first character of the substring.

SUBSTR

Length is the number of characters to return.


The position of a character is represented by a number that indicates (left to right) where
the character sits in the string. For example, position 3 in the string "discount" is the
character "s".
Example
IF [Date Of Reject] <> "" THEN [Date Of Reject] >=
SUBSTR([Referral Date Time],1,8)
Validates that if the Date of Reject field is not a null value, then the date is greater than
or equal to the Referral Date Time substring. The substring starts with the first character
in the Referral Date Time field and is 8 (eight) characters in length.

Function

Description

Converts a string to a number.


TO_NUMBER

TO_NUMBER(String)
where String is the value that will be converted to a number.
Removes the white space characters (space, tab, new line, carriage return, and form
feed) from the start and end of a string.

TRIM

TRIM(String)
where String is the value on which any leading and trailing white space characters will
be removed.
Returns the string converted to UPPERCASE.

UPPER

UPPER(String)
where String is the value that will be converted to UPPERCASE characters.

Transformation Functions

Humanizes the specified string.

HUMANIZE("Some_Text")
HUMANIZE

where Some_Text is the text you want to "humanize" by making it look similar to human
language text.
For example, to change "RANDOM USAGE" to "Random Usage", use this function:
HUMANIZE("RANDOM_USAGE")
Returns the Metaphone code.

METAPHONE

METAPHONE(String)
where String is the value for which you want the Metaphone code.
Returns a Pattern in the specified pattern style of a string.
PATTERN(String,"Pattern_Type")
where String represents the values for which the pattern will be returned, and
Pattern_Type is one of three pattern types: "default", "rich" or "long".

PATTERN

Example
If the pattern_style is specified as "rich" and the values in Company are CNN
Company, CNN, and ESPN then the expression
PATTERN(Company,"rich") LIKE "a3"
would return CNN.
Returns the Soundex of a string.

SOUNDEX

SOUNDEX(String)
where String is the value for which you want the Soundex code.

Function

STANDARDIZE

Description

Turns a value into a canonical or standard representation. After values are standardized,
it is possible to determine if two or more similar values are also equivalent values.
standardize(,)

Type Functions
Returns 1 (TRUE) if String is empty.
IS_EMPTY("String")
IS_EMPTY
where String is the string you want to test.
For example, IS_EMPTY("") returns 1 (TRUE). IS_EMPTY("Jones") returns 0
(FALSE).
Returns 1 (TRUE) if String is a valid Boolean.
IS_LOGICAL("String")
IS_LOGICAL
where String is the string of characters you want to test.
For example, IS_LOGICAL("Y") returns 1 (TRUE). IS_LOGICAL(0) returns 1
(TRUE). IS_LOGICAL("G") returns 0 (FALSE).
Returns 1 (TRUE) if String is a valid number.
IS_NUMBER("String")
IS_NUMBER
where String is the string of characters you want to test.
For example, IS_NUMBER("1.3") returns 1 (TRUE). IS_NUMBER("1.3s") returns 0
(FALSE).
Converts an integer into a decimal.
TO_DECIMAL

TO_DECIMAL(Number)
where Number is the integer number you want to change to a decimal.
For example, TO_DECIMAL(22) returns 22.0.
Converts a decimal into an integer by rounding down.

TO_INT

TO_INT(Number)
where Number is the decimal number you want to round down.
For example, TO_INT(22.523) returns 22.

Expression Builder Functions


You can use various Functions for building data filters, conditional statements and attribute transformation in the
Quality component. All values are case-sensitive.
When using literal values such as New York, enclose the value in double quotation marks. Attribute names and
numeric values do not require quotation marks. Any numeric value enclosed in quotation marks, such as 123
will be read as a literal value.

Function
Name

Description

Aggregate
The Aggregate functions are only available in the input row filters for the Set Selection Utility. See Expression
Builder Functions for Sets of Records.
Numeric
between

Means "attribute value is between."


Example: between(12,34)

String
join

String concatenation with a space. This is equivalent to the string operator "|:".
Syntax: join([attribute1],[attribute2])

concat

String concatenation without a space. This is equivalent to the string operator "||".
Syntax: concat([attribute1],[attribute2])

contains

Tests whether the attribute contains the specific value.


Syntax: contains ([attribute], "value")

hexval

Converts a hex value to a character.


Example: Attribute 1 = hexval("41") || hexval("41") || hexval("52") || hexval("4F") || hexval ("4E") ||
hexval("0D") || hexval "(0A")
This operation sets Attribute 1 to AARON, with a CR/LF at the end.

When using the hexval function, always put quotation marks around input values.
insstr

Inserts a string 1 to string 2 at specified offset.


Syntax: insstr (CHANGE_STRING,VALUE_STRING,OFFSET, OVERWRITE_FLAG)
This puts VALUE_STRING into CHANGE_STRING, starting at OFFSET.
If OVERWRITE_FLAG is set to I, VALUE_STRING is inserted; if OVERWRITE_FLAG is set to O,
VALUE_STRING overwrites.
Example 1: Attribute 1 = insstr (Attribute 2,123,3,I)
If Attribute 2 contained the string ABCDEFGHI, then this operation sets Attribute 1 to
ABC123DEFGHI. (Note that DEFGHI was pushed to the left.)
Example 2: Attribute 1 = insstr (Attribute 2,123,3,O)
If attribute 2 contained the string ADCDEFGHI, then this operation sets Attribute 1 to
ABC123GHI. (Note that DEF was overwritten.)

lcase

Converts the value of attribute to lowercase.


Syntax: lcase([attribute])

occstr

Finds the location of a substring within another string and returns a numeric value.
Syntax: occstr(FIELD_STRING,VALUE_STRING,DIRECTION)
If DIRECTION is set to L, then FIELD_STRING is parsed from right to left; if DIRECTION is set to
R, then FIELD_STRING is parsed from left to right. This function is typically used in conjunction
with other functions (Example 2).
Example 1: Attribute 1 = occstr (Attribute 2,DEF,R)
If Attribute 2 contained the string ABCDEFGHI, this operation sets Attribute 1 to 3.
Example 2: insstr (Attribute 2, 123,occstr (Attribute 2,D,R),O)

Function
Name

Description
If Attribute 2 contained the string ABCDEFGHI, this operation sets Attribute 1 to ABCD123GH.
The occstr operator returns 4 and the resulting insstr is: Attribute 1 = insstr Attribute 2,123",4,O)

strsub

String substitution. Converts the value of attribute according to the String Substitutions Table, also
known as the uplow table (strsub.win). This function is useful for converting a name to proper
case. For example, you can convert Mccarthy to McCarthy and LABLANC to LaBlanc.
Syntax: strsub([attribute])
Example 1: Attribute 1 = strsub (Attribute 1)
This will set "KEVIN W MCCARTHY" to "KEVIN W. McCarthy". To title case "KEVIN" which is not in
the table, you can use the following expression:
Example 2: Attribute 1= strsub(tcase(Attribute 1))
This will title case all words before looking up the String Substitutions Table.
The table is located in: ../../tables/general_resources. You can edit the table by copying it
to the client and then uploading it back to the server. The left side of the table is case-insensitive
and the right side is case-sensitive.

substr

Creates a substring.
Syntax: substr(CHANGE_STRING,OFFSET,LENGTH)
This creates a substring from CHANGE_STRING, starting at OFFSET for the number of characters
specified in LENGTH. This operation can also be used in an IF statement (Example 2).
Example 1: Attribute 1 = substr (Attribute 2,3,3)
If Attribute 2 contained the string ABCDEFGHI, this operation sets Attribute 1 to DEF.
Example 2: IF (substr (Attribute 2,3,1) = A)
If the third character of Attribute 2 is A, the IF returns True.

tcase

Converts the value of attribute to title case (initial cap).


Syntax: tcase([attribute])

tostr

Converts the value of attribute to specific string.

trim

Removes leading and trailing spaces from attribute data.


Syntax: trim([attribute])

ucase

Converts the value of attribute to uppercase.


Syntax: ucase ([attribute])

Quality

See Quality Functions for Asian Countries.

Potrebbero piacerti anche