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

Functions You Can Use in a Calculated Expression


Table 206 describes the functions that you can use in a calculated expression. The Result column describes the type of result the function returns. The Query column indicates if Siebel CRM can use the function in a query.

Table 206. Functions You Can Use in a Calculated Expression
Function
Result
Query
Description

AccountId

String

Yes

Returns the account ID of the current user.

ContactLoginId

String

Yes

Returns the contact ID of the current user.

If you configure Siebel CRM to not use the contact login method for a Web application, then this function cannot get any value and it returns an empty string. It is recommended that you use a contact login and an external security authentication service. For example, LDAP.

Count ("mvlink")

Integer

No

Returns the number of rows in the multivalue group that the mvlink defines, where mvlink identifies the name of a multivalue link.

Currency

String

Yes

Returns the currency code for the current position. For example, USD.

DivisionId

Integer

Yes

Returns the division ID of the current user.

To limit visibility to employees who reside in the same division as the person who is currently logged in, you can add the following code 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. You can use this function to do the following:

  • Limit visibility to employees who reside in the same division as the person who is currently logged in.
  • Display the division name of the user who is logging the service request.

You can create a new calculated field so that Siebel CRM displays the division name in the calculated field. It displays the division name of the user who is logged in when this user creates a service request.

If you use the configuration that the Using the Division Functions topic describes, then Siebel CRM predefaults the Reported By Division joined field to this division name, and this field never receives another value after Siebel CRM creates this service request.

EXISTS

String

Yes

For example:

IIf(EXISTS([Participant-Employee Login] = LoginName()), "Y", "N")

GetProfileAttr ("Attribute")

String

Yes

Returns the value that Siebel CRM stores in the profile attribute if this attribute is defined. You can use this function in personalization to do the following:

  • Get attribute values in a user profile.
  • Send information from a script to the client.

You can set a personalization attribute for a session that is equal to the value of the shared global attribute, and then reference the personalization attribute in a calculated field.

GetProfileAttr returns NULL for an undefined attribute or for an attribute that is not configured. For example:

GetProfileAttr("Attribute") = ""

If the attribute does not exist, or if it exists and if the value is different than "", then this code returns FALSE.

For example:

GetProfileAttr("Attribute") IS NULL

If the attribute does not exist, then this code returns TRUE.

IfNull (expr1, expr2)

Type of expr1

Yes

Returns one of the following values:

  • If expr1 is not NULL, then this function returns the value of expr1.
  • If expr1 is NULL, then this function returns the value of expr2.

IIf (testExpr, expr1, expr2)

Type of expr1

No

Returns one of the following values:

  • If testExpr is TRUE, then this function returns the value of expr1.
  • If testExpr is not TRUE, then this function returns the value of expr2.

If the expression references a DTYPE_NUMBER field, then the data type of expr1 determines the data type of the value that this function returns.

For more information, see Using the IIf Function.

InvokeServiceMethod ("ServiceName",
"MethodName",
"InputProp1=val1, InputProp2=val2, ...",
"OutputProp")

String

No

For more information, see Using the Invoke Service Method in a Calculated Field.

JobTitle

Integer

Yes

Returns the Job Title of the employe who is currently logged in. It is similar to the PositionId and DivisionId methods.

JulianDay

Integer

Yes

Equal to the Oracle Julian Day for all dates in the 20th and 21st centuries.

JulianMonth

Integer

Yes

Equal to:

JulianYear()* 12 + currentMonth

where:

  • January = 1.

JulianQtr

Integer

Yes

Equal to:

JulianYear() * 4 + currentQuarter

where:

  • currentQuarter = (currentMonth - 1) / 3 + 1 rounded down to the next integer.

JulianWeek

Integer

Yes

Equal to the following, rounded down to the next integer:

JulianDay()/ 7

JulianYear

Integer

Yes

Equal to the current year plus 4713.

Language

String

Yes

Returns the language code for the language that the client currently uses. For example, ENU.

One of the following items sets this language:

  • Language parameter in the CFG file
  • /L parameter when starting Siebel CRM.

This setting is not the OM - Resource Language Code server parameter that the Administration - Server Configuration screen contains.

Left (text, integer)

String

Yes

Returns the leftmost n characters in the text string or field. For example, the following code returns Adam:

Left ("Adams", 4)

Len

String

Yes

Returns the length of a string or string variable. You can specify the number of characters between parentheses.

Locale

String

Yes

Returns the locale code that is associated with the Application Object Manager (AOM). A locale is a set of rules that determine how Siebel CRM displays data to the user or receives data from the user.

Siebel CRM stores locale codes in the LOCALE_CODE column of the S_LOCALE table. For more information, see Siebel Global Deployment Guide.

LocalCurrency

String

Yes

Returns the currency code for the client computer. For example, JPY.

LoginId

String

Yes

Returns the login ID. For example, 0-3241.

LoginName

String

Yes

Returns the login name. For example, BSTEVENS.

Lookup (type, value)

String

No

Returns the value of the ORDER_BY column of a row in the S_LST_OF_VAL list of values where:

  • The TYPE column matches the type argument.
  • The VALUE column matches the value argument.

You can use this function to avoid creating joins in a business component.

LookupExpr (type, value_expr)

String

No

Returns the value of the ORDER_BY column of the first row in the S_LST_OF_VAL list of values that the expression evaluates to TRUE.

To do this, it searches rows in this list of values where the TYPE column matches the type argument.

It evaluates the contents of the VALUE column as an expression.

This function does an in-memory linear parse evaluate search. You must make sure that the LOV type contains less than 30 rows.

LookupName (type, lang_ind_code)

String

Yes

Returns the language-independent code that resides in the NAME column of the S_LST_OF_VAL list of values where:

  • The TYPE column matches the type argument.
  • The NAME column matches the lang_ind_code argument.
  • The LANG_ID column matches the language code of the language that is currently active.

This function gets the untranslated value from this list of values.

LookupTranslation([fieldname])

String

No

Returns the value of the field in the language that the client displays.

LookupValue (type, lang_ind_code)

String

No

Returns the display value that the VAL column contains in a row in the S_LST_OF_VAL list of values where:

  • The TYPE column matches the type argument.
  • The NAME column matches the lang_ind_code argument.
  • The LANG_ID column matches the language code of the currently active language.

This method finds the display value for the lang_ind_code. If it does not find this value, then it returns the value that lang_ind_code contains.

This function gets the translation of the untranslated value from this list of values.

Max ([mvfield])

Integer

No

Returns the maximum value from a field in child records. You must define the child record that this function examines as a multivalue field that a multivalue group contains. This multivalue group is associated with the business component that contains the field that this method evaluates.

For example:

Max ([Number of Employees])

This code gets the maximum number of employees for all locations.

Min ([mvfield])

Integer

No

Returns the minimum value from a field in child records.

You must define the child record that Siebel CRM examines as a multivalue field that is part of a multivalue group. The multivalue group is associated with the business component of the field that Siebel CRM evaluates.

For example:

Min ([Number of Employees])

This code returns the minimum number of employees that exist for all locations.

OrganizationId

Integer

Yes

Returns the organization ID of the user who is currently logged in. It returns this value if Siebel CRM does not define an organization for the user. For example, if the user uses a customer application, then it returns the ID of the Default Organization.

OrganizationName

String

Yes

Returns the organization name of a user who is an employee.

ParentBCName

String

Yes

Returns the name of the parent business component of an active link. For example, Opportunity.

ParentFieldValue (field_name)

String

Yes

Returns the value of the field_name field that resides in the parent business component. It returns the result as a string. If Siebel CRM updates the parent row, then it does not modify this result. You must use Link Specification = TRUE to export the parent business component field.

If a parent business component does not exist, or if Siebel CRM does not instantiate it, such as in a script, then this function returns the following error:

No active link

PositionId

String

Yes

Returns the position ID of the user who is currently logged in as an employee. For example, 0-4432.

PositionName

String

Yes

Returns the position name of the user who is currently logged in as an employee.

Preference ("category", "pref_name")

String

Yes

Returns the value for a category and preference name. For example, the Price List field in the Service Agreement business component contains the following predefault value:

Expr: "Preference (""Quote"", ""PriceList"")"

This example returns the price list that Siebel CRM uses for a quote that the Price List Sales Methodology view of the User Preferences screen specifies. This view resides in the client.

Right (text, integer)

String

Yes

Returns the rightmost n characters in the text string or field. For example, the following code returns dams.

Right ("Adams", 4)

RowIdToRowIdNum ([Id])

String

Yes

Converts an alphanumeric row ID to a unique, numeric row ID in the Service Request business component.

Sum ([mvfield])

Integer

No

Sums the values from a field in child records into a field in a parent record. You must define this child record as a multivalue field that is part of a multivalue group. This multivalue group is associated with the business component that contains the field in the parent record.

SystemPreference ("Preference")

String

Yes

Returns the value of a system preference. For example:

SystemPreference("Training: Employee Calendar")

This code returns TRUE for an employee.

You can use this function to set a predefault or postdefault value. For example, the following code sets a predefault value:

Expr: 'SystemPreference("Default Time Zone")'

You can set these values in the following ways:

  • In the client. Use the System Preferences view of the Administration - Application screen.
  • In Siebel Tools. Click the Screens menu, System Administration, and then click System Preferences.

ToChar ([field_name], 'format')

String

No

Returns a string that represents a number or date in a format that the optional format argument specifies. For example:

ToChar([Start Date], 'MM/DD/YYYY')

This code returns the starting date of a record as a string that uses the following format:

MM/DD/YYYY

The following examples describe the difference between using # and 0 for a number that does or does not include decimal places. The # symbol only returns decimal places if they exist. The 0 symbol adds decimal places if the number contains fewer decimals than the format argument specifies:

  • ToChar (10, '##.##') returns 10
  • ToChar (10, '##.00') returns 10.00
  • ToChar (10.2345, '##.00') returns 10.23
  • ToChar (10.2345, '##.##') returns 10.23

If you do not specify the format argument, then the ToChar function returns a string that it formats according to the current locale. For example, if the current locale is ESN, then ToChar formats the string according to the ESN locale.

Timestamp

Date Time

or

UTC Date Time

Yes

For more information, see Using the Timestamp Function.

Today

Date

Yes

Returns the date for today. For example, 1/26/2012.

The Today function and the Timestamp function functions might return different results. For more information, see Using the Timestamp Function.

UtcConvert ("utc_date_time", "time_zone")

Date Time

Yes

This function converts UTC time to local time in the time zone that the time_zone argument specifies. For example:

UtcConvert("12/14/2012 5:07:05 PM", "Eastern Standard Time")

This code returns the following value:

12/14/2012 12:07:05 PM

UtcOffset ("utc_date_time", "time_zone")

 

Integer

Yes

Returns the UTC offset in minutes for a date and time in the time zone that the time_zone argument specifies. It returns one of the following values:

  • Positive value. Indicates the number of minutes ahead of UTC.
  • Negative value. Indicates the number of minutes behind UTC.

For example:

UtcOffset("3/30/2012 14:00:00", "Pacific Standard Time")

This code returns the following value because 3/30/2012 14:00:00 occurs 7 hours behind UTC:

-420

For example:

UtcOffset("3/30/2012 14:00:00", "India Standard Time")

This code returns the following value because the time occurs 5.5 hours ahead of UTC:

330

Siebel Developer's Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.