Siebel Reports Administration Guide > Method Reference > Essential DataStream Methods >

Fetch Method


The Fetch method performs three functions:

  1. Positions the Siebel Object Manager interface to a single row in the business object.
  2. Creates a blank instance of the data row.
  3. Populates the data row by calling methods on the business component Siebel Object Manager interface.

The following code sample is from the Fetch method in the ssAccountQuery datastream component in the Aclist (Account List) report.

Function Fetch () As AcDataRow

Dim bStatus As Boolean

Dim bCurRowOnly As Boolean

Dim custDataRow As ssAccountDataRow

Dim theBC As Integer

errCode = 0

bStatus = False

bCurRowOnly = False

theBC = ssAccount

If (bCurRowOnly = True) Then

If (Position = 1) Then

If (baseReport::bQueryExecuted = True) Then

bStatus = ssBusCompFirstRecord (theBC)

Else

bStatus = True

End If

End If

Else

If (Position = 1) Then

bStatus = ssBusCompFirstRecord (theBC)

If (errCode = 0) And (baseReport::bSetForward) Then ssBusCompInvokeMethod (theBC, "SetForwardOnly", "")

Else

bStatus = ssBusCompNextRecord (theBC)

End If

End If

If (bStatus = True) And (errCode = 0) Then

Set custDataRow = NewDataRow

If (errCode = 0) Then custDataRow.ssAccount_Status = ssBusCompGetFieldValue (theBC, "Account Status")

If (errCode = 0) Then custDataRow.ssCity = ssBusCompGetFieldValue (theBC, "City")

If (errCode = 0) Then custDataRow.ssCompetitor = ssBusCompGetFieldValue (theBC, "Competitor")

If (errCode = 0) Then custDataRow.ssCountry = ssBusCompGetFieldValue (theBC, "Country")

If (errCode = 0) Then custDataRow.ssDescription = ssBusCompGetFieldValue (theBC, "Description")

If (errCode = 0) Then custDataRow.ssIndustry = ssBusCompGetFieldValue (theBC, "Industry")

If (errCode = 0) Then custDataRow.ssLocation = ssBusCompGetFieldValue (theBC, "Location")

If (errCode = 0) Then custDataRow.ssMain_Fax_Number = ssBusCompGetFormattedFieldValue (theBC, "Main Fax Number")

If (errCode = 0) Then custDataRow.ssMain_Phone_Number = ssBusCompGetFormattedFieldValue (theBC, "Main Phone Number")

If (errCode = 0) Then custDataRow.ssName = ssBusCompGetFieldValue (theBC, "Name")

If (errCode = 0) Then custDataRow.ssParent_Account_Name = ssBusCompGetFieldValue (theBC, "Parent Account Name")

If (errCode = 0) Then custDataRow.ssPostal_Code = ssBusCompGetFieldValue (theBC, "Postal Code")

If (errCode = 0) Then custDataRow.ssState = ssBusCompGetFieldValue (theBC, "State")

If (errCode = 0) Then custDataRow.ssStreet_Address = ssBusCompGetFieldValue (theBC, "Street Address")

If (errCode = 0) Then custDataRow.ssSynonym = ssBusCompGetFieldValue (theBC, "Synonym")

If (errCode = 0) Then custDataRow.ssType = ssBusCompGetFieldValue (theBC, "Type")

' Now retrieve the system fields

If (errCode = 0) Then custDataRow.ssId = ssBusCompGetFieldValue (theBC, "Id")

If (errCode = 0) Then custDataRow.ssCreated = ssBusCompGetFieldValue (theBC, "Created")

If (errCode = 0) Then custDataRow.ssCreated_Formatted = ssBusCompGetFormattedFieldValue (theBC, "Created")

If (errCode = 0) Then custDataRow.ssCreated_By = ssBusCompGetFieldValue (theBC, "Created By")

If (errCode = 0) Then custDataRow.ssUpdated = ssBusCompGetFieldValue (theBC, "Updated")

If (errCode = 0) Then custDataRow.ssUpdated_Formatted = ssBusCompGetFormattedFieldValue (theBC, "Updated")

If (errCode = 0) Then custDataRow.ssUpdated_By = ssBusCompGetFieldValue (theBC, "Updated By")

Set Fetch = custDataRow

AddRow (Fetch)

Else

Set Fetch = Nothing

End If

If (errCode <> 0) Then

ssProcessLastError(ssAppServer, "", "")

End If

End Function

In this example, the value of bStatus defines the position of the first data row. While bStatus is true, custDataRow continues to pass rows until no values are returned. The SetForwardOnly method makes sure that all rows are processed and that duplicate rows are not passed.

NOTE:  Because all data is returned as strings, two methods are called on the GetFieldValue business component Siebel Object Manager interface variable (for all data types) and on GetFormattedFieldValue (for date, currency, and other data types that require formatting).

GetFieldValue and GetFormattedFieldValue are described in Table 43.

Table 43.  GetFieldValue and GetFormattedFieldValue
Method
Comments
GetFieldValue
Gets the raw data value. Dates are always mm/dd/yy hh:mm:ss. Numbers and currency are always strings. Can be used to sum numeric values.
GetFormattedFieldValue
Uses the format specified in the Siebel client. Called by default for each currency field ("$1,234.34"). Called by default for any date field ("01/12/31"). Numeric values cannot be summed.

NOTE:  These calls to the two methods are no longer done directly. Instead, these are called as ssBusCompGetFieldValue and ssBusCompGetFormattedFieldValue. These methods are implemented in sssiebel.bas and call the above mentioned methods.


 Siebel Reports Administration Guide, Version 7.5, Rev B 
 Published: 18 April 2003