Query Result Class
The QueryResult class contains the results to a HierarchyQuery. The results are structured as a table where each row represents a symbol entry, and the columns represent the properties for that symbol.
Property Summary
- Property ColumnCount As Long
- Property RowCount As Long
Sub/Function Summary
- Function GetCellValue(row As Long, column as Long) As String
Properties
Parameter | Description |
---|---|
ColumnCount |
Property ColumnCount As Long Gets the number of columns in the query result.
You can use this information to help you write your query to a worksheet or iterate through the columns to do some processing in your VBA code. |
RowCount |
Property RowCount As Long Gets the number of rows in the query result. Each row represents a symbol entry. |
Subs/Functions
Parameter | Description |
---|---|
GetCellValue |
Function GetCellValue(row As Long, column As Long) As String Returns the string value at the specified row/column. Each row represents a symbol entry while the columns are the properties of the symbol as follows:
|
Sample Usage:
Sub RunHierarchyQuery()
On Error GoTo ErrorHandler
Dim result As Longview.QueryResult
Dim query As Longview.HierarchyQuery
Set query = New Longview.HierarchyQuery
Set result = query.Run()
Dim row As Long
Dim column As Long
For row = 1 to result.RowCount
For column = 1 to result.ColumnCount
‘ Place results of symbol query into cells of the worksheet manually
Range(“A1”).Offset(row – 1, column – 1).Value = result.GetCellValue(row, column)
Next column
Next row
ErrorHandler:
If Err.Number <> 0 Then
MsgBox “Unable to run Hierarchy Query (“ & Err.Number & “) – “ &
Err.Description
End If
End Sub