Siebel Tools >  Operators/Functions for Calculated Fields in eScript in Siebel

Operators/Functions for Calculated Fields in eScript in Siebel

Here are some functions that you can use in Calculated Fields, e.g. in a Business Component Field.

GetProfileAttr is a function that contains a number of Key and values. You can find different types of variables

by changing the function name GetProfileAttr 

Here  are some examples.

GetProfileAttr('Personal Country')

GetProfileAttr('Personal Country')

GetProfileAttrAsList('User Responsibilities')

GetProfileAttrAsInt('Age')

GetProfileAttrAsDate('Birth Day')

GetProfileAttrAsTime('Last Login Time')

GetProfileAttrAsDateTime('Last Login Date')

GetProfileAttrAsUtcDateTime('Last Login Date')

 

Here are some more functions that can be used in calculated fields 

ContactLoginId()  - Login of the current user

EXISTS : Checks if a value exists. EXISTS([Fieldname]. IIf(EXISTS(LoginName(), "Login exists", "Login does not exist"))

 

IfNull (var1, var2) : return var1. If var1 is null, then return var2

 

 IIf (cond1, var1, var2) : If condition is true, then return var1 , otherwise return var2 

 

Len() : This calculates the length of a string. Returns a number. e.g. IIF(len(Login)==3, "Three","Not Three")

 

LoginName ()  = Login ID used to log into Siebel.

 

LookupName (type, lang_ind_code) : The type in an LOV. lang_ind_code examples can be ENG,ITA,ENU. The full list can be found with this sql : select distinct lang_cd from siebel.s_lang

 

LookupValue (type, lang_ind_code) : The values of an LOV type. If there are no such types for this language code, then it returns just the language code.

 

ParentBCName() : Give the name of the Business Component that is running the code.

e.g.

var boName = this.BusObject().Name();

var bcParent = this.BusComp().ParentBusComp();

var parentBCName = bcParent.Name();

Right (text, integer) : Returns the rightmost characters. Right("Hello", 2) gives lo

 

SystemPreference ("Name of Preference") . The list can be found in Administration - Application screen, System Preferences view.

 

ToChar ([Field Name in Business Component], 'format') : Similar to the to_char function in Oracle SQL. Changes the field to a date format. The field must be of type Date i.e. DTYPE_DATE or DTYPE_DATETIME

e.g. ToChar([Requested Ship Date], 'dd:mm:yyyy')

 

Comparision Operators:
[~]    when bit is 0, this makes it 1. When bit value is 1, it becomes 0.

==     is equal to. Value should not be null. 

    less than. Value should not be null.

    greater than. Value should not be null.

<=     less than or equal to. Value should not be null.

>=     greater than or equal to.Value should not be null.


Field names should be in Third Brackets. e.g. When the field is called Closing Date, we should use [Closing Date]


LIKE   - Similarity operator. e.g. if Field Name is First Name, we can write [Field Name] like ['Sharon*']. Anything after Sharon is  accepted. If we want to compare with only one character after Sharon, we should use [Field Name] like ['Sharon?']

 

NOT LIKE - Just the opposit of LIKE.

NOT   - e.g. IIf([First Name] NOT 'Sharon', 'Not Sharon', 'Sharon')

AND   - e.g. IIF([First Name] == 'Sharon' AND [Last Name] == 'Horowitz')

OR    - e.g. IIF([First Name] == 'Sharon' OR [First Name] == 'Lena')


Arithmetic


   Add   

   Subtract

   Multiply

   Divide