Configuration Guide for Siebel Offline Client for Life Sciences > Configuration Files, Filter Definitions, and Calculated Expressions > Calculated Expressions >
Predefined Functions
Expression Parser supports a limited number of predefined functions. The following tables describe the functions that are identified as valid expression functions used for calling the Expression Parser:
Table 45 describes valid expression string functions.
Table 45. Valid Expression String Functions
|
|
|
Concat(expr1, expr2) |
String |
Returns the concatenation of expr1 and expr2. |
GetPreference("identifier") |
String |
Gets the value of the preference associated with the identifier. |
Language() |
String |
Specifies the preferred language value. |
Left(expr, integer) |
String |
Leftmost integer of the expression. If the integer is empty, the default is 1. |
LowerCase(expr) |
String |
Converts the expression to lowercase. |
LPad(expr1,integer,expr2) |
String |
Adds the <expr2> repeatedly to the left of <expr1> until the result reaches the length of <integer> characters. |
Replace(expr1,expr2,expr3) |
String |
Replaces each occurrence of expr2 in expr1 with expr3. |
Right(expr, integer) |
String |
Rightmost integer of the expression. |
SubString(expr, integer1, integer2) |
String |
Returns the substring portion of the expression starting in position of integer1, returning the length of integer2. |
Trim(expr) |
String |
Deletes all leading and trailing spaces from the expression. |
UpperCase(expr) |
String |
Converts the expression to uppercase. |
Table 46 describes valid expression XML functions.
Table 46. Valid Expression XML Functions
|
|
|
Count([expr]) |
Number |
Counts the number of child elements in the data structure passed in with the argument expr . If no argument expr is specified, the function counts the number of child elements in the data structure. You must set this prior to calling Count() using the function SetXMLData(xmlData). |
ParentField("<fieldname>") |
String |
The field name enclosed in quotation marks. For example, ParentField("Location") will return the value of the field Location on the parent xml node. If no value is returned, then the result is an empty string value. |
Table 47 describes valid expression date functions.
Table 47. Valid Expression Date Functions
|
|
|
AddHrs(expr, integer) |
Date |
Adds the number of integer hours to the expression expr that must evaluate to a date or time and returns the result. For example, AddHrs(TimeStamp(),1) returns the time one hour from the current time. |
AddDay(expr, integer) |
Date |
Adds the number of integer days to the expression expr that must evaluate to a date or time and returns the result. For example, AddDay(TimeStamp(),1) returns tomorrow's date. The value of the expression must resolve to a date. |
AddMins(expr, integer) |
Date |
Adds the number of integer minutes to the expression expr that must evaluate to a date or time and returns the result. For example, AddMins(TimeStamp(),1) returns the time it will be in one minute from now. |
AddSecs(expr, integer) |
Date |
Adds the number of integer seconds to the expression expr that must evaluate to a date or time and returns the result. For example, AddSecs(TimeStamp(),1) returns the time it will be in one second from the current time. |
AddWeek(expr, integer) |
Date |
Adds the number of integer weeks to the expression expr that must evaluate to a date or time and returns the result. For example, AddWeek(TimeStamp(),1) returns the date it will be in one week from today. |
AddYear(expr, integer) |
Date |
Adds the number of integer years to the expression expr that must evaluate to a date or time and returns the result. For example, AddYear(TimeStamp(),1) returns the date it will be in one year from today. |
DateSequence(expr1,expr2) |
Boolean |
Returns true if either of the values for expr1 or expr2 is null, or, if the value of expr1 is less than, or equal to, expr2 . The values for expr1 and expr2 must be date fields. |
Day(expr) |
Int |
Returns the day of the month for the expression. The value of expr must evaluate to a date. |
DayOfWeek(expr) |
Int |
Returns the numeric equivalent of the day of the week based on system values of the expression. The expression must evaluate to a date. |
DaysBetween(expr1, expr2) |
Int |
Returns the number of days between expr1 and expr2 . The values for expr1 and expr2 must evaluate to a date. |
Month(expr) |
Int |
Returns the numeric equivalent of the month in the year. This value is calculated by adding a value of one to the system value. Alternatively, this is done by the calculating the date range for the month by taking the first day of the month from the last of the month for the expression. When a date range is used, it is usually a query-based request. |
SubTime(expr1,expr2) |
String |
Subtracts the values expr2 from expr1 . The two values for expr1 and expr2 must be in the DateTime format. This value returns the time difference in milliseconds, which is converted to string format. |
TimeStamp() |
Date |
Full timestamp of the system date. TimeStamp() returns a date variable representing the current date and time (including milliseconds). |
Today() |
Date |
System date value formatted. |
Year(expr) |
Int |
Returns the fullYear attribute of the expression. The value of the expression must evaluate to a date. |
Table 48 describes valid expression math functions.
Table 48. Valid Expression Math Functions
|
|
|
Count([expr ]) |
Number |
Counts the number of children in the data passed in the expression. Alternatively, if no data is passed, this function counts the XML data set before calling the expression parser. |
ParentField("<fieldname>") |
String |
Indicates the field name enclosed in quotation marks. For example, ParentField("Location") returns the value of the field location on the parent XML node. If no value is returned, then the result is an empty string value. |
IIf(condition expr, true expr, false expr) |
Object |
The condition expression must evaluate to a Boolean. If the condition evaluates to True, the result of the true expression is returned. Otherwise, the result of the false expression is returned. The default value of the condition expression is false. |
IfNull(expr1, expr2) |
Type of expr1 |
Returns the value of expr1 unless expr1 is NULL, in which case the value of expr2 is returned. |
LookUpName(LOV Type, Display Value, [Parent LIC]) |
String |
Returns the Language Independent Code (LIC) of Display Value based on LOV Type, (Parent LIC is optional).
- Indicates the value of LOV Type. The type code for the LOV is usually the concatenation of entity name (for example, Account) and picklist field name (for example, AccountType) as follows:
Account\AccountType .
- Indicates the display value, which is the language dependent display value of the value you want to convert.
- Indicates the parent Language Independent Code (LIC) of the parent pick field (only for hierarchical picklists).
|
LookUpValue(LOV Type, LIC, [Parent LIC]) |
String |
Returns the Display Value for a given LIC:
- Indicates the LOV Type. The type code for the LOV is usually the concatenation of entity name (for example, Account) and picklist field name (for example, AccountType) as follows:
Account\AccountType .
- Indicates the LIC of the value to convert.
- Indicates the parent LIC. This is the LIC of the parent pick field (only for hierarchical picklists) This returns the characters "" for non hierarchical picklists.
|
Table 49 describes valid expression system functions.
Table 49. Valid Expression System Functions
|
|
|
Current_User |
String |
Returns the current user ID value. |
GetSessionAttribute(expr) |
String |
Gets the session attribute value of expr . |
GetPreferences(expr) |
String |
Gets the preference value associated with expr . |
Not(expr) |
Boolean |
Returns a value of True or False based on the value of expr , which must evaluate to a Boolean. |
True() |
String |
Returns True as a value. |
False() |
String |
Returns False as a value. |
About the Expression Parser Class
The expression parser class has the following public functions in addition to the constructor: NOTE: In object-oriented programming, a constructor is a type of subroutine called at the creation of an object that prepares the object for use.
- ExpressionParser. Accepts the expression string as input.
- CreateTopLevel. Accepts the top-level node name and the key associated with the top-level node.
- AddChild. Accepts the envelope of the child node, the child node name, and the key associated with the child node.
- ChangeKey. Accepts the node name and the key for that node.
- SetXMLData. Accepts the XML data used for the expression parser class.
Before the expression parser can be called, you must specify the top level, any children, and the associated XML data, for example: var EP:ExprParser = new ExprParser; EP.CreateTopLevel("Contact",strRecKey); EP.AddChild("ListOfAccounts","Account",strChildKey); EP.SetXMLData(xmlFileData); var obj:Object = EP.ExpressionParser(strParseString);
If you want to change the child record, then call the ChangeKey function with the node name and key to be used to access the key, for example: EP.ChangeKey("Account",strChildKey);
If you change the top-level key, then call the CreateTopLevel function again. This action clears the context and key arrays used for accessing the XML data.
|