Skip to main content
insightsoftware Documentation insightsoftware Documentation
{%article.title%}
Published:
Was this article helpful?
0 out of 0 found this helpful

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. 

  • If IncludeDescriptions = True, there will be 4 columns. 
  • If IncludeDescriptions = False, there will be 2 columns.

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:

  • IncludeDescriptions = True
    • Column 1 – Symbol Name
    • Column 2 – Symbol Description
    • Column 3 – Parent Symbol Name
    • Column 4 – Parent Symbol Description
  • IncludeDescriptions = False
    • Column 1 – Symbol Name
    • Column 2 – Parent Symbol Name
  • Parameters:
    • row – Long representing row number co-ordinate
    • column – Long representing the column number co-ordinate
  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the specified row or column is outside the range of valid values.

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

Published:

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. 

  • If IncludeDescriptions = True, there will be 4 columns. 
  • If IncludeDescriptions = False, there will be 2 columns.

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:

  • IncludeDescriptions = True
    • Column 1 – Symbol Name
    • Column 2 – Symbol Description
    • Column 3 – Parent Symbol Name
    • Column 4 – Parent Symbol Description
  • IncludeDescriptions = False
    • Column 1 – Symbol Name
    • Column 2 – Parent Symbol Name
  • Parameters:
    • row – Long representing row number co-ordinate
    • column – Long representing the column number co-ordinate
  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the specified row or column is outside the range of valid values.

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

For an optimal Community experience, Please view on Desktop