Inserting Effective-Dated Data Example Using Visual Basic
Here's a code example in Visual Basic that does the same thing as the previous code example.
Private Sub CURRENCY_CD()
On Error GoTo eMessage
'***** Set Object References *****
Dim oCISession As Object
Dim oCURRENCY_CD As Object
Dim oCURRENCY_CD_TBL As Object
Dim oCURRENCY_CD_TBLItem As Object
'***** Set Connect Parameters *****
strAppSeverPath = "//PSOFT101999:9000"
strOperatorID = "PTDMO"
strPassword = "PTDMO"
'***** Create PeopleSoft Session Object *****
Set oCISession = CreateObject("PeopleSoft.Session")
'***** Connect to the App Sever *****
oCISession.Connect 1, strAppSeverPath, strOperatorID, strPassword, 0
'***** Get the Component *****
Set oCURRENCY_CD = oCISession.GetCompIntfc("CURRENCY_CD")
'***** Set the Component Interface Mode *****
oCURRENCY_CD.InteractiveMode = False
oCURRENCY_CD.GetHistoryItems = True
'***** Set Component Get/Create Keys *****
oCURRENCY_CD.CURRENCY_CD = "USD"
'***** Execute Create *****
oCURRENCY_CD.Get
'Set CURRENCY_CD_TBL Collection Field Properties --
'Parent: PS_ROOT Collection
Set oCURRENCY_CD_TBL = oCURRENCY_CD.CURRENCY_CD_TBL
Set oCURRENCY_CD_TBLItem = oCURRENCY_CD_TBL.InsertItem(oCURRENCY_CD_⇒
TBL.CurrentItemNum())
oCURRENCY_CD_TBLItem.EFFDT = Date
oCURRENCY_CD_TBLItem.EFF_STATUS = "A"
oCURRENCY_CD_TBLItem.DESCR = "NewCurrencyCode"
oCURRENCY_CD_TBLItem.DESCRSHORT = "New"
oCURRENCY_CD_TBLItem.COUNTRY = "USA"
oCURRENCY_CD_TBLItem.CUR_SYMBOL = "?"
oCURRENCY_CD_TBLItem.DECIMAL_POSITIONS = 4
oCURRENCY_CD_TBLItem.SCALE_POSITIONS = 0
'***** Save Component Interface *****
oCURRENCY_CD.Save
oCURRENCY_CD.Cancel
Exit Sub
eMessage:
'***** Display VB Runtime Errors *****
MsgBox Err.Description
'***** Display PeopleSoft Error Messages *****
If oCISession.PSMessages.Count > 0 Then
For i = 1 To oCISession.PSMessages.Count
MsgBox oCISession.PSMessages.Item(i).Text
Next i
End If
End Sub
Sub MAIN()
CURRENCY_CD
End Sub