Siebel Developer's Reference > Operators, Expressions, and Conditions >

Functions in Calculation Expressions


Calculation expressions are calculated field and validation expressions.

NOTE:  AccountId (), ContactLogin(), JobTitle(), and OrganizationId() are meant to be used as predefault value and postdefault value in business components.
They are not supported in Siebel VB or through COM objects.

You cannot use custom functions in calculated expressions.

Use only numbers between -2147483647 and 2147483648 in field validation expressions.

Table 137 describes the functions you can use in these expressions.

Table 137. Functions Used in Calculated Expressions
Function
Result Type
Query
Description
AccountId()
String
Yes
Returns the current user's Account ID (OU_ID).
ContactLoginId()
String
Yes
Returns the contact ID of the currently logged in user.
If you do not use the contact login method for a Web-based application, the function cannot retrieve any value and returns an empty string. It is recommended that you use the contact login method and an external security authentication service (for example, LDAP).
Count ("mvlink")
Integer
No
Returns the number of rows in the multi-value group defined by the MVL mvlink.
Currency ()
String
Yes
Returns the currency code for the current position (for example, USD).
DivisionId ()
Integer
Yes
Returns the current user's Division ID (BU_ID).
To limit visibility to employees from the same division as the person logged in, add the following to the search specification property of the Applet:
[Division Id] = DivisionId()
DivisionName ()
String
Yes
Returns the division name of a user who is an employee.
Use to limit visibility to employees from the same division as the person logged in.
Also use to display the division name of the user logging the service request.
Create a new calculated field so that, when the service request is created, the calculated field displays the division name of the current logged user that is creating the service request. Using the following configuration, the new joined field Reported By Division will be predefaulted to this value, and will never receive another value after this service request creation event.
To create a calculated field that displays the division name of the current logged user creating a service request:
  1. In the Service Request business component, create a new calculated field:

    Calculated: TRUE
    Calculated Value: DivisionName()
    Name: Division (Calc)
    Parent Name: Service Request
    Type: DTYPE_TEXT
  2. In the Service Request Business Component, also create a new join to S_SRV_REQ_X table:

    Column: ATTRIB_03
    Join: S_SRV_REQ_X
    Name: Reported By Division
DivisionName ()
(continued)
 
 
Pre Default Value: Field:
'Division Name'
Read Only: TRUE
Expose the joined field Reported By Division in the relevant applets.
You may also want to expose the calculated field Division (Calc), just to check the logic and set Visible = False later for the control or list column exposed.
EXISTS
String
Yes
For example:
IIf(EXISTS( [Participant-Employee Login] = LoginName()), "Y", "N").
GetProfileAttr ("Attribute")
 
String
Yes
Returns the value stored in the profile attribute if that attribute has been defined. Used in personalization to retrieve values of attributes in a user profile and to pass information from a script to the UI.
Set a session-specific personalization attribute equal to the value of the shared global and reference the personalization attribute in a calculated field.
NOTE: For an undefined attribute or for an attribute that has not been set up, GetProfileAttr returns NULL. This is important when you are using comparison operators. For example:
  • GetProfileAttr("Attribute") = "" always returns FALSE either if the Attribute does not exist or exists and the value is different than "".
  • GetProfileAttr("Attribute") IS NULL returns TRUE if the Attribute does not exist and FALSE otherwise.
IfNull (expr1, expr2)
Type of expr1
Yes
Returns the value of expr1 unless expr1 is NULL, in which case the value of expr2 is returned.
IIf (testExpr, expr1, expr2)
Type of expr1
No
If testExpr is TRUE, returns the value of expr1; otherwise returns the value of expr2.
NOTE: If working with DTYPE_NUMBER fields, the Data Type of expr1 determines the Data Type of the resulting value.
InvokeServiceMethod ("[ServiceName]",
"[MethodName]",
"[InputProp1=val1, InputProp2=val2]",
"[OutputProp")
String
No
Invokes a business service from a calculated field and returns [Output Prop].
NOTE: Do not expose a calculated expression that invokes a business service in a list applet. Doing so may result in poor performance because the business service will be repeatedly instantiated each time the field appears in the list.
JobTitle ()
 
Integer
Yes
Returns the Job Title of the currently logged-in employee. Similar to PositionId () and DivisionId ().
JulianDay ()
Date
Yes
Equal to the Oracle (and Sagent) Julian Day, for all dates in the 20th and 21st centuries.
JulianMonth ()
Date
Yes
Equal to the JulianYear() * 12 + currentMonth, where January = 1.
JulianQtr ()
Date
Yes
Equal to the JulianYear() * 4 + currentQuarter, where currentQuarter = (currentMonth - 1) / 3 + 1 rounded down to the next integer.
JulianWeek ()
Date
Yes
JulianDay() / 7, rounded down to the next integer.
JulianYear ()
Date
Yes
Equal to the current year + 4713.
Language ()
String
Yes
Returns the language code (for example, ENU) which is the active client language setting, set by the Language parameter in the CFG file, or by the /L parameter when starting a Siebel application.
NOTE: This is not the Resource Language parameter.
Left (text, integer)
String
Yes
Returns the leftmost n characters in the text string or field. For example, Left ("Adams", 2) returns "Ad."
Len()
String
Yes
Returns the length of a string or string variable. The number of characters is specified between parentheses.
LocalCurrency ()
String
Yes
Returns the currency code for this machine (for example, JPY).
LoginId ()
String
Yes
Login ID (for example, 0-3241).
LoginName ()
String
Yes
Login name (for example, BSTEVENS).
Lookup (type, value)
String
No
Finds a row in S_LST_OF_VAL where the TYPE column matches the type argument and the VALUE column matches the value argument. The function returns the value of the ORDER_BY column for that row.
The primary purpose of the Lookup function is to avoid additional joins in a business component.
LookupExpr (type, value_expr)
String
No
Searches the rows in S_LST_OF_VAL where the TYPE column matches the type argument. Evaluates the contents of the VALUE column treated as an expression. Returns the value of the ORDER_BY column for the first row for which the expression evaluates to TRUE.
The LookupExpr function essentially performs an in-memory linear parse evaluate search, so you should make sure that there are fewer than 30 rows in the LOV type.
LookupName (type, lang_ind_code)
 
String
Yes
Finds a row in S_LST_OF_VAL where the TYPE column matches the type argument, the CODE column matches the lang_ind_code argument, and the LANG_ID column matches the language code of the currently active language. Returns the language-independent code (the CODE column) for the row.
This function is used to obtain the untranslated value in the specified LOV.
LookupValue (type, lang_ind_code)
String
No
Finds a row in S_LST_OF_VAL where the TYPE column matches the type argument, the CODE column matches the lang_ind_code argument, and the LANG_ID column matches the language code of the currently active language. Returns the display value (the VAL column) for the row.
LookupValue tries to find the display value for the specified lang_ind_code. If not found, LookupValue just returns the lang_ind_code itself as the value.
This function is used to obtain the translation of the specified untranslated value in the specified LOV into the currently active language.
NOTE: The LookupValue() function cannot be used directly in the Pre Default Value property of a field. Instead, use a separate calculated field for the lookup, and reference the calculated field in the Pre Default Value property of the original field.
OrganizationId ()
Integer
Yes
Returns the organization ID of the currently logged in user.
OrganizationName ()
String
Yes
Returns the organization name of a user who is an employee.
ParentBCName ()
String
Yes
Parent (master) business component name for active link (for example, Opportunity).
ParentFieldValue (field_name)
String
Yes
Returns the value of the field_name field in the parent business component. The result is not typed correctly but is always of type String. Also, the result does not change if the parent row is updated. The parent business component field must be exported by using Link Specification = TRUE.
PositionId ()
String
Yes
Position ID of currently logged-in employee (for example, 0-4432).
PositionName ()
String
Yes
Position name of currently logged-in employee.
Right (text, integer)
String
Yes
Returns the right-most n characters in the text string or field.
For example, Right ("Adams", 2) returns "ms"
RowIdToRowIdNum ([Id])
String
Yes
Converts an alphanumeric row ID to a unique, pure numeric row ID in the Service Request business component.
In Siebel eBusiness 6.x, this expression has changed functionality; it is used for the predefault value of the "SR Number" field.
Sum ([mvfield])
Integer
No
Sums the values from a field in child records into a field in a parent record. The child record being summed from must be defined as a multivalue field that is part of a multi-value group that is associated with the business component of the field being summed to.
ToChar (num_expr, format)
String
No
Returns a string that represents a number or date in a format specified by the optional format parameter. (For example, ToChar (10, "##.##") returns "10.00").
Timestamp ()
Date Time
Yes
Today's date and time (for example,
01/02/96 11:15:22).
The Timestamp function can also be used in queries. For example:

Created >= Timestamp() - 0.1

against an MS SQL Server database would return those records created within the last one-tenth of a day.
Today ()
Date
Yes
Today's date (for example, 1/26/96).

 Siebel Developer's Reference 
 Published: 23 October 2003