- 1 Minute to read
- Print
- DarkLight
- PDF
Segment2_Retrieve
- 1 Minute to read
- Print
- DarkLight
- PDF
Retrieves the collection of Segment2 objects that meet the filter criteria supplied. Each segment2 object returned from this method corresponds to a data row of segment2 in the database.
Syntax
Segment2 = api.Segment2_Retrieve (Segment2Filter FilterCriteria)
Usage
Use the Segment2_Retrieve call to retrieve Segment2 data. When a Client application invokes the Segment2_Retrieve call, it passes the segment2 filter criteria in collection of Segment2Filter objects to filter the data rows.
Upon invocation, the Web Service queries the database for segment2 data rows with the specified filter criteria and returns the collection of segment2 objects. Each segment2 object corresponds to a data row in the database. The Client application can then use methods on the collection of segment2 objects to iterate through the collection and retrieve information. The Client application must be logged in with sufficient access rights to query segment2 objects.
Arguments list
The following table provides a list of arguments that are required for the Segment2_Retrieve method call:
Name | Type | Description |
---|---|---|
Segment2Filter | Segment2F | Collection of segment2 filter objects to filter the segment2 data rows during retrieval. |
Response
The Segment2_Retrieve method call returns a collection of Segment2 objects, which contain the data values of segment2 data rows in the database. In recent updates, the retrieved data will also have the IDs of all the Leaf, Roll-Up, and Parent Members.
Sample Code
Private Sub RetrieveSegment2()
Dim api As New HostAPI()
'This method retrieves all segment2 objects that start with the code specified.
Dim objSegment2() As Segment2, objSegment2Filter As Segment2Filter
Dim objSegment2FilterCollection() As Segment2Filters, strValue() As String
Try
'Create a new segment2 filter to add the filter criteria during retrieval
objSegment2Filter = New Segment2Filter
objSegment2Filter.Field = Segment2Field.Code
objSegment2Filter.FieldOperator = FieldOperator.StartsWith
ReDim strValue(0)
strValue(0) = "10"
objSegment2Filter.Value = strValue
'Add the filter objects built to the filter collection to pass to the web method
ReDim objSegment2FilterCollection(0)
objSegment2FilterCollection(0) = New Segment2Filter
objSegment2FilterCollection(0) = objSegment2Filter
'Call the web method to retrieve the segment2 collection
objSegment2 = api.Segment2_Retrieve (objSegment2FilterCollection)
'Loop through the segment2 collection to display the segment2 objects retrieved
If Not objSegment2 is Nothing Then
Console.WriteLine ("Code" & vbTab & "|" &_Obj.Name & vbTab &
"|AccountGroup" & vbTab & "|AccountyType")
For Each _Obj As Segment2 In objSegment2
Console.WriteLine (_Obj.Code & vbTab & "|" _Obj.Name & vbTab &
"|" & _Obj.AccountGroup.ToString() & vbTab & "|" &
_Obj.AccountType.ToString())
Next
End If
Console.ReadLine()
Catch ex As Exception
End Try
End Sub