Siebel Object Interfaces Reference > Interfaces Reference > Business Component Methods >

GetFormattedFieldValue


GetFormattedFieldValue returns the field value in the current local format; it returns values in the same format as the Siebel UI.

Syntax

BusComp.GetFormattedFieldValue(FieldName)

Argument
Description
FieldName
String variable or literal containing the name of the field to obtain the value from

Returns

A string containing the value of the requested field, in the same format as displayed in the user interface, or an empty string ("") if the field is inactive or empty.

Usage

GetFormattedFieldValue is useful for code that is used in multiple countries with different formats for currency, date, and number. This method can be used only on fields that have been activated using ActivateField.

Some special behavior is associated with particular data types.

DTYPE_PHONE. When used on fields of DTYPE_PHONE, these methods return formatted phone numbers.

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. When used on fields of DTYPE_DATE, these methods are the same as GetFieldValue and SetFieldValue, except that the result is in the format of the Regional Setting.

Table 24 shows the standard formats used by GetFieldValue and SetFieldValue to return data.

Table 24.  Date and Time Formats
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 SetFieldValue and your Regional Setting format is different, you receive an error like this:

Error: The value '31-Dec-99' can not be converted to a date time value.

This error can be avoided by using the GetFormattedFieldValue and SetFormattedFieldValue methods.

Used With

Browser Script, Server Script, Mobile/Dedicated Web Client Automation Server, COM Data Control, COM Data Server, Java Data Bean, CORBA Object Manager

Example

The following Siebel VB example demonstrates how to use the GetFormattedFieldValue function and how to calculate 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

See Also

ActivateField
GetFieldValue
SetFieldValue
SetFormattedFieldValue


 Siebel Object Interfaces Reference 
 Published: 18 June 2003