Skip to main content

AttributeQuery

The QueryResult class contains the results to an AttributeQuery. The results are structured as a table where each row represents an attribute entry. The columns represent the properties for that attribute.

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 querying attribute definitions, there are 6 columns.
  • If querying attribute values, there are 7 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 an attribute 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 attribute while the columns are the properties of the symbol as follows:

  • Attribute Definitions

    • Column 1 – Attribute class
    • Column 2 – Attribute name
    • Column 3 – Attribute description
    • Column 4 – Attribute type
    • Column 5 – Attribute access (Read/Write)
    • Column 6 – Attribute default value
  • Attribute values
    • Column 1 – Attribute class
    • Column 2 – Attribute name
    • Column 3 – Attribute description
    • Column 4 – Attribute type
    • Column 5 – Attribute object (user name, symbol name)
    • Column 6 – Attribute value
    • Column 7 – N/A for default, Y/N whether value is the same as the default.
  • 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 RunAttributeQuery()

On Error GoTo ErrorHandler

Dim result As Longview.QueryResult

Dim query As Longview.AttributeQuery

Set query = New Longview.AttributeQuery

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 Attribute Query (“ & Err.Number & “) – “ &

Err.Description

End If

End Sub

Was this article helpful?

We're sorry to hear that.