S
steve1040
All I have the following code from Ebay's Api sample coding.
Based on a keyword the call will return up to 10 suggested
categories.
With the highest percentage as first item.
How can I modify this code to return only the very top ranked
suggestion (1 record)
Thanks
Steve
***Start Code****
'Display the results
result = "COUNT: " & response.selectSingleNode
("GetSuggestedCategoriesResponse/CategoryCount").Text
result = result & vbCrLf & vbCrLf
Dim n, cn As IXMLDOMNode ' node and childnode
'go through each suggestedcategory
For Each n In response.selectSingleNode
("GetSuggestedCategoriesResponse/SuggestedCategoryArray").childNodes
If n.nodeName = "SuggestedCategory" Then
Dim catName, catID, catItems As String
Dim first As Integer
catID = n.selectSingleNode("Category/
CategoryID").Text
catName = n.selectSingleNode("Category/
CategoryName").Text
catItems = n.selectSingleNode
("PercentItemFound").Text
'output the suggested category
MsgBox n.nodeName
result = result & catName & " (" & catID & ") - "
& catItems & "%" & vbCrLf
End If
Next
lblResponse.Caption = result
*** End Code ***
Based on a keyword the call will return up to 10 suggested
categories.
With the highest percentage as first item.
How can I modify this code to return only the very top ranked
suggestion (1 record)
Thanks
Steve
***Start Code****
'Display the results
result = "COUNT: " & response.selectSingleNode
("GetSuggestedCategoriesResponse/CategoryCount").Text
result = result & vbCrLf & vbCrLf
Dim n, cn As IXMLDOMNode ' node and childnode
'go through each suggestedcategory
For Each n In response.selectSingleNode
("GetSuggestedCategoriesResponse/SuggestedCategoryArray").childNodes
If n.nodeName = "SuggestedCategory" Then
Dim catName, catID, catItems As String
Dim first As Integer
catID = n.selectSingleNode("Category/
CategoryID").Text
catName = n.selectSingleNode("Category/
CategoryName").Text
catItems = n.selectSingleNode
("PercentItemFound").Text
'output the suggested category
MsgBox n.nodeName
result = result & catName & " (" & catID & ") - "
& catItems & "%" & vbCrLf
End If
Next
lblResponse.Caption = result
*** End Code ***