Upload
bhaskar-reddy
View
213
Download
0
Embed Size (px)
Citation preview
8/10/2019 trillium functions
1/11
Expression Builder Operators
This table describes the operators available for building business rules, filters, and logical expressions orconditional 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
Greater Than
>= Greater Than or Equal To
Logical
AND
A conjunction between two statements (not case-sensitive).
A conjunction is TRUE if, but only if, both of its statements are TRUE.
Example
IF, THEN, ELSE
Logical condition operators. ELSEstatement is optional.
IF expression1THEN expression2ELSE expression3|TRUE|FALSE
Example
IF, THEN, ELSE IF,
THEN, ELSE
Logical condition operators. Syntax is similar to the IF, THEN, ELSElogical statement.
IF expression1 THEN expression2 ELSE IF expression3 THEN
8/10/2019 trillium functions
2/11
Operator Meaning
expression4 ELSE expression5|TRUE|FALSE
Example
NOT
Reverses the Truth value of the statement that follows (not case-sensitive).
Example
OR
An inclusive disjunction between two statements (not case-sensitive).
The disjunction is TRUE if either, or both, of the statements are TRUE.
Example
This expression validates that if the Sort Code field is populated, then it iscorrect 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
IN
Allows you to test if a value is equal to one of a list of values.
source_opIN (n1,n2nx)
Example
You can create validation and business rules based on whether a value is equal to one ofa 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 aSort Code value) is tested against the expected pattern for that value.
PATTERN([Sort Code],"default") LIKE"d9"
Like
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_opLIKE"string"
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 5in the 3rd position, you would build anexpression similar to this:
8/10/2019 trillium functions
3/11
Operator Meaning
Product_Id LIKE"??5*"
Expression Builder Functions
This table describes the functionsavailable 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
DATE_TO_SECONDS
Returns the specified date as seconds. This command parses and converts anystandard date or time string. If you specify only the time, the functionuses the currentdate as the default.
DATE_TO_SECONDS(DateString)
where DateStringis a string that contains the time and optional month/day/year date.
Example
DATE_TO_SECONDS(15:54 12/14/05) returns 1134575640.
DAYMONTHYEAR
Returns the specified date, given as day/month/year, in seconds.
DAYMONTHYEAR(DateString)
where DateStringis a string that contains the day/month/year date.
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 dateformat.
MONTHDAYYEAR
Returns the specified date, given as month/day/year, in seconds.
MONTHDAYYEAR(DateString)
whereDateStringis a string that contains the month/day/year date.
Examples
MONTHDAYYEAR(12-12-05)returns 1134345600.
MONTHDAYYEAR(12/12-05)returns 1134345600.
If you typedMONTHDAYYEAR(2005-14-12), you receive the error Invalid dateformat.
NOW Returns the current date and time as seconds.
NOW()
8/10/2019 trillium functions
4/11
Function Description
Example
If it isDecember 14, 2005,the functionNOW()returns 1134575640.
SECONDS_IN
Returns the number of seconds in a given time period. Use this functionto get thenumber of seconds in a specified number of days, weeks, and so forth.
SECONDS_IN(TimePeriod)
where TimePeriodis a string that indicates the number of hours, days, weeks, months,
and so forth.
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.
SECONDS_TO_DATE
Converts given seconds to the specified date/time format.Field descriptorsconsist of a%followed by a field descriptor character. All other characters are copied into the result.
SECONDS_TO_DATE(Seconds,Format)
where:
Secondsis the number of seconds to convert.
Formatis a string of one or more field descriptors that indicatethe format to use.
Example
SECONDS_TO_DATE(1133312345,%a %b %d %H:%M:%S %Z %Y)returns WedNov 30 00:59:05 GMT 2005.
Click herefor a list of SECONDS_TO_DATEfield descriptors.
YEARDAYMONTH
Returns the specified YEAR DAY MONTH date as seconds.
YEARDAYMONTH(DateString)
where DateStringis the date you want to convert to seconds.
Examples
YEARDAYMONTH(05/14-12)returns 1134518400.
YEARDAYMONTH(5/1/1)returns 1104537600.
YEARDAYMONTH(2005/01/01)returns 1104537600.
YEARMONTHDAY
Returns the specified YEAR MONTH DAY date as seconds.
YEARMONTHDAY(DateString)
where DateStringis the date you want to convert to seconds.
Examples
YEARMONTHDAY(2005-12-01)returns
1133395200.
YEARMONTHDAY(5/12/1)returns 1133395200.
http://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Profiling/Content/Assessing_Data_Compliance/Expression%20Builder/SEC_TO_DATE_Field_Descriptors.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Profiling/Content/Assessing_Data_Compliance/Expression%20Builder/SEC_TO_DATE_Field_Descriptors.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Profiling/Content/Assessing_Data_Compliance/Expression%20Builder/SEC_TO_DATE_Field_Descriptors.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Profiling/Content/Assessing_Data_Compliance/Expression%20Builder/SEC_TO_DATE_Field_Descriptors.htm8/10/2019 trillium functions
5/11
Function Description
Numeric Functions
ABS
Returns the absolute value of a number.
ABS(Number)
where Numberis the number for which you want the absolute value.
For example,ABS(-1.123)returns the value 1.123.
CEILING
Rounds a decimal number up to the nearest larger integer.
CEILING(Number)
where Numberis the decimal number you want to round up.
For example, CEILING(1.123)returns 2.0.
FLOOR
Rounds a decimal number down to the nearest smaller integer.
FLOOR(Number)
where Numberis the decimal number you want to round down.
For example, FLOOR(1.123)returns 1.0.
MOD
Returns the decimal remainder of the division of Number1by Number2.
MOD(Number1,Number2)
where:
Number1is the number to be divided.
Number2is the number by which Number1is divided.
For example,MOD(94,9)returns the remainder 4.0.
PERCENT
Returns the percentage that Number2is of Number1.
PERCENT(Number1,Number2)
where:
Number1is the number used to calculate the percentage of Number2in Number1.
Number2is the number divided into Number1to calculate the percentage that
Number2is of
Number1.
For example, PERCENT(48,12)returns the percentage 25.0.
POWER
Calculates the values of Number1raised to the power of Number2.
POWER(Number1,Number2)
where:
Number1is the number you want to calculate the power of.
Number2specifies the power to use in the calculation.
For example, the functionPOWER(4,4)returns 256.0.
ROUND Rounds a decimal number to its nearest integer.
8/10/2019 trillium functions
6/11
Function Description
ROUND(Number)
SQUARE_ROOT
Returns the square root of a number,
SQUARE_ROOT(Number)
where Numberis the number for which you want the square root.
For example, the functionSQUARE_ROOT(81)returns 9.0.
TO_CHAR
Returns a number formatted to ndecimal places with a localized decimal point.
TO_CHAR(Number,Precision)
where:
Numberis the number for which you want the absolute value.Precisionis the number of decimal places to use.
Example
TO_CHAR(1,23456)returns 1.2345 or in German locale1,2345.
String Functions
APPEND
Appends arguments (such as strings, attributes,and integers) together with a spacebetween each argument.
APPEND(Argument1,Argument2,Argument3)
where:
Argument1indicates the first argument in a series of appended arguments.
Argument2indicates the second argument in a series.
Argument3indicates the third argument, and so forth.
CONCAT
Concatenates two string values into a single string.
CONCAT(String1,String2)
where String1and String2are the two string values to be joined into one string.
LENGTH
Returns the character length of the string.
LENGTH(String)
where Stringis the value on which the character length gets returned.
LOWER
Returns the string converted to lowercase.
LOWER(String)
where Stringis the value that will be converted to all lowercase characters.
LTRIMTrims the leading (left-side) white space.
LTRIM(String)
8/10/2019 trillium functions
7/11
Function Description
where Stringis the value on which any leading white space characters will be
removed. White space characters are spaces, tabs, new lines, carriage returns, andform feeds.
REGEXP
Applies regular expressions to a string.
REGEXP("Expression","String")
where:
Expressionis the expression you want to use.
Stringis the string to which you want to apply the expression.
For example, the functionREGEXP("(ab|a)c","zabcdefgh")returns "abc".
RTRIM
Trims the trailing (right-side) white space.
RTRIM(String)
where Stringis the value on which any trailing white space characters will be
removed. White space characters are spaces, tabs, new lines, carriage returns, andform feeds.
SUBSTITUTE
Replaces all instances of FindStringwith ReplaceStringin the specifiedInputString.
SUBSTITUTE("InputString", "FindString", "ReplaceString")
where:
InputStringis the target string in which text is replaced.
FindStringis the text to find so that it can be replaced.ReplaceStringis the text you want to replace it with.
For example, the functionSUBSTITUTE ("substitute test", "te", "xx")returns "substitute xxst".
SUBSTR
Returns a substring.
SUBSTR(String,Start,Length)
where:
Stringis the value to use to create the substring.
Startis a number that indicates the position of the character in the string that will
become the first character of the substring.
Lengthis the number of characters to return.
The position of a character is represented by a number that indicates (left to right) wherethe character sits in the string. For example, position 3 in the string "discount" is thecharacter "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 thanor 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.
8/10/2019 trillium functions
8/11
Function Description
TO_NUMBER
Converts a string to a number.
TO_NUMBER(String)
where Stringis the value that will be converted to a number.
TRIM
Removes the white space characters (space, tab, new line, carriage return, and formfeed) from the start and end of a string.
TRIM(String)
where Stringis the value on which any leading and trailing white space characters will
be removed.
UPPER
Returns the string converted to UPPERCASE.
UPPER(String)
where Stringis the value that will be converted to UPPERCASE characters.
Transformation Functions
HUMANIZE
Humanizes the specified string.
HUMANIZE("Some_Text")
whereSome_Textis 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")
METAPHONE
Returns the Metaphone code.
METAPHONE(String)
where Stringis the value for which you want the Metaphone code.
PATTERN
Returns a Pattern in the specified pattern style of a string.
PATTERN(String,"Pattern_Type")
where Stringrepresents the values for which the pattern will be returned, and
Pattern_Typeis one of three pattern types:"default", "rich" or "long".
Example
If the pattern_styleis 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.
SOUNDEX
Returns the Soundex of a string.
SOUNDEX(String)
where Stringis the value for which you want the Soundex code.
http://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Profiling/Content/Discovering_Data_Content/Patterns/Default_Rich_Long_Patterns.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Profiling/Content/Discovering_Data_Content/Patterns/Default_Rich_Long_Patterns.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Profiling/Content/Discovering_Data_Content/Patterns/Default_Rich_Long_Patterns.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Profiling/Content/Discovering_Data_Content/Patterns/Default_Rich_Long_Patterns.htm8/10/2019 trillium functions
9/11
Function Description
STANDARDIZE
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
IS_EMPTY
Returns 1(TRUE) if Stringis empty.
IS_EMPTY("String")
where Stringis the string you want to test.
For example, IS_EMPTY("")returns 1(TRUE). IS_EMPTY("Jones")returns 0(FALSE).
IS_LOGICAL
Returns 1(TRUE) if Stringis a valid Boolean.
IS_LOGICAL("String")
where Stringis the string of characters you want to test.
For example, IS_LOGICAL("Y")returns1(TRUE). IS_LOGICAL(0)returns 1(TRUE). IS_LOGICAL("G")returns 0(FALSE).
IS_NUMBER
Returns 1(TRUE) if Stringis a valid number.
IS_NUMBER("String")
where Stringis the string of characters you want to test.
For example, IS_NUMBER("1.3")returns 1(TRUE). IS_NUMBER("1.3s")returns 0(FALSE).
TO_DECIMAL
Converts an integer into a decimal.
TO_DECIMAL(Number)
where Numberis the integer number you want to change to a decimal.
For example, TO_DECIMAL(22)returns 22.0.
TO_INT
Converts a decimal into an integer by rounding down.
TO_INT(Number)
where Numberis the decimal number you want to round down.
For example, TO_INT(22.523)returns 22.
Expression Builder Functions
You can use various Functionsfor building data filters, conditional statements and attribute transformation in theQuality component. All values are case-sensitive.
When using literal values such as New York, enclose the value in double quotation marks. Attribute names andnumeric values do not require quotation marks. Any numeric value enclosed in quotation marks, such as 123
will be read as a literal value.
8/10/2019 trillium functions
10/11
Function
NameDescription
Aggregate
The Aggregate functionsare only available in the input row filters for the Set Selection Utility. SeeExpression
Builder Functionsfor 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 funct ion, 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 toABC123DEFGHI. (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 setsAttribute 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 toR, then FIELD_STRING is parsed from left to right. This functionis typically used in conjunctionwith 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)
http://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Functions_SetSel.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Functions_SetSel.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Functions_SetSel.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Functions_SetSel.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Functions_SetSel.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Functions_SetSel.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Functions_SetSel.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Functions_SetSel.htm8/10/2019 trillium functions
11/11
Function
NameDescription
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, alsoknown as the uplow table (strsub.win). This functionis 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 inthe 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 itto 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 charactersspecified 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 SeeQuality Functionsfor Asian Countries.
http://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Quality_Functions.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Quality_Functions.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Quality_Functions.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Quality_Functions.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Quality_Functions.htmhttp://d/OraHome_1/oracledq/client/docs/Oracle_ODQWebHelp/Subsystems/Oracle_WebHelp_Quality/Content/Working_with_Quality_Process/Using_Expression_Builder/Quality_Functions.htm