SetFormattedFieldValue Method for a Business Component
The SetFormattedFieldValue method sets a new value in a field in the current record of a business component. It accepts the field value in the current local format. This method does not return any information.
Format
BusComp.SetFormattedFieldValue FieldName, FieldValue
The arguments you can use this format are the same as the arguments described in SetFieldValue Method for a Business Component.
Usage
The SetFormattedFieldValue method is useful if you write code for a Siebel application that you deploy in multiple countries that use different currency, date, and number formats.
You can use the SetFormattedFieldValue method only on a field that is active. For more information, see ActivateField Method for a Business Component.
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 is a fragment from a program that tracks the progress of an opportunity through sales stages:
Function BusComp_PreWriteRecord As Integer
Dim OpportunityBO as BusObject, StageBC as BusComp
Dim OppStageId as String, SalesRep as String, Stage as String
Dim StagePrev As String, StageDate as String, StageDatePrev as String
Dim Dx as Double, Dy as Double, Diff as Double, DiffStr as String
Dim OppID As String, OppStageId as String, StageID As String
Dim SalesStageBO as BusObject, SalesStageBC as BusComp
Set OpportunityBO = TheApplication.GetBusObject ("Opportunity")
Set SalesStageBO = TheApplication.GetBusObject ("Sales Cycle Def")
Set SalesStageBC = SalesStageBO.GetBusComp("Sales Cycle Def")
With SalesStageBC
.SetViewMode AllView
.ClearToQuery
.SetSearchSpec "Sales Cycle Stage", StagePrev
.ExecuteQuery ForwardOnly
If (.FirstRecord) Then
StageId = .GetFieldValue("Id")
End With
'Instantiate stage BC
Set StageBC = OpportunityBO.GetBusComp("Opportunity Stage")
'Check that we do not already have a record for the stage
With StageBC
.SetViewMode AllView
.ClearToQuery
.SetSearchSpec "Sales Stage Id", StageId
.ExecuteQuery ForwardOnly
'Proceed further only if we do not already have record
'opportunity sales stage
If (.FirstRecord = 0) Then
'Create a new stage record and write it out
.NewRecord NewAfter
'Record Id for future use
OppStageId = .GetFieldValue("Id")
.SetFieldValue "Opportunity Id", OppId
.SetFieldValue "Sales Stage Id", StageId
.SetFieldValue "Sales Rep", SalesRep
.SetFormattedFieldValue "Entered Date", StageDatePrev
.SetFormattedFieldValue "Left Date", StageDate
Dx = DateValue (StageDatePrev)
Dy = DateValue (StageDate)
Diff = Dy - Dx
DiffStr = Str(Diff)
.SetFieldValue "Days In Stage", DiffStr
.WriteRecord
End If
End With
Set SalesStageBC = Nothing
Set SalesStageBO = Nothing
Set StageBC = Nothing
Set OpportunityBO = Nothing
End Function