GetFormattedFieldValue Method for a Business Component
The GetFormattedFieldValue method returns the following information:
A string that contains a field value that is in the same format that the Siebel client uses.
An empty string if the field is inactive or empty.
Format
BusComp.GetFormattedFieldValue(FieldName)
The arguments you can use in this format are the same as the arguments that are described in ActivateField Method for a Business Component.
Usage
You can use the GetFormattedFieldValue method with code that your implementation uses in multiple countries that use different formats for currency, date, or numbers.
Usage with Phone Data and Date Data
The following behavior exists for phone data and date data:
DTYPE_PHONE. If you use the GetFormattedFieldValue method with a field whose Type property is DTYPE_PHONE, then this method returns a formatted phone number.
Example 1:
phone = bc.GetFieldValue("Main Phone Number") TheApplication.Trace "The number is " & phone
Result:
The number is 8869629123
Example 2:
phone = bc.GetFormattedFieldValue("Main Phone Number") TheApplication.Trace "The number is " & phone
Result:
The number is (886) 962-9123
DTYPE_DATE. If you use the GetFormattedFieldValue method with a field whose Type property is DTYPE_DATE, then the result is the same as the GetFieldValue method or the SetFieldValue method except that the GetFormattedFieldValue method returns the value in the same format as the Regional Setting.
The following table describes the formats that the GetFieldValue method and the SetFieldValue method use.
Type of Data | Format |
---|---|
Dates |
mm/dd/yyyy |
Times |
hh:nn:ss |
Date-times |
mm/dd/yyyy hh:nn:ss |
If you attempt to use the SetFieldValue method, and if the Regional Setting format is different, then Siebel CRM displays an error that is similar to the following:
Error: The value '31-Dec-99' can not be converted to a date time value.
To avoid this error, use the GetFormattedFieldValue format or the SetFormattedFieldValue method.
Used With
Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples
The following Siebel VB example uses the GetFormattedFieldValue method and calculates the number of days between two dates:
Sub Button_Click
Dim DateDiff as Integer
Dim oBC as BusComp
Set oBC= me.BusComp
x = oBC.GetFormattedFieldValue("Start Date")
y = oBC.GetFormattedFieldValue("Done")
dx = DateValue(x)
dy = DateValue(y)
DateDiff = dy - dx
End Sub
Related Topics
For more information, see the following topics: