All about calculated fields
=> Calculated fields are the ones that obtain their value from other fields of the same or parent business components.
=> A calculated field’s value is not stored in database.
=> Querying is allowed on calculated field values but sorting is not allowed.
=> Their value doesn’t change immediately as the value of their source field changes. For immediate change, we need to assign ‘Immediate Post Changes’ property of the field to TRUE.
=> Calculated field expressions are not checked for any syntax validation, so configurator needs to take care of it on his own end.
1. To get the responsibility list of currently logged in user :
InStr(GetProfileAttrAsList (“User Responsibilities”), “<Responsibility>”)
GetProfileAttrAsList returns all the responsibilities associated to a particular user separated by comma (,).
2. To Invoke a business service and that returns a value :
InvokeServiceMethod (“ServiceName“,”MethodName“,”Parameter1=val1, Parameter 2=val2, …”,”OutputVar“)
3. Messages can also be displayed directly into a calculated field :
e.g. Calcfield = “Hello World”
Calcfield = “Hello [field]”
4. Concatenation of fields :
[field1] + [fields2] + …
5. Changing font and color of text :
“<b><font face=’Tahoma’ size=10 color=’green’>”+[field name] + “</font></b>”
Avoid using functions that can’t be directly incorporated into WHERE clause of resulting SQL like IIf() and Lookup(), result in testing each record in the business component to determine which records to display to the user, at a considerable performance cost.