Skip to main content

AttributeQuery Class

The AttributeQuery class represents an attribute query that is built from the menu option: Attribute Query. The functions and properties of this class can be used to build a new attribute query, modify an existing attribute query and output the results to a worksheet.

Property Summary

  • Property AttributeClass As AttributeClassType
  • Property RetrieveType As AttributeRetrieveType

Sub/Function Summary

  • Sub AddAttributeDefinition(attributeName As String)
  • Function GetSymbolAttributeValue(attributeName As String, symbolName As String, [useDefault As Boolean = True]) As String
  • Function GetSystemAttributeValue(attributeName As String, [useDefault As Boolean = True]) As String
  • Function GetUserAttributeValue(attributeName As String, userName As String, [useDefault As Boolean = True]) As String
  • Sub ClearDefinitions()
  • Sub LoadQuery(fileName As String)
  • Function Run ([worksheetName As String], [cell As String]) As QueryResult
  • Sub RunToWorksheet([worksheetName As String], [cell As String])

Properties

Parameter Description
AttributeClass

Property AttributeClass As AttributeClassType

Specifies the class of the attributes to query. The attribute class determines which type of Longview attribute will be retrieved.

  • AttributeClassType_Symbol – Retrieves symbol attributes.
  • AttributeClassType_System – Retrieves system attributes. This is the default.
  • AttributeClassType_User – Retrieves user attributes.
AttributeRetrieveType

Property AttributeRetrieveType As AttributeRetrieveType

Specifies whether to retrieve attribute definitions or the attribute values. This property controls the type of information returned by the query.

  • AttributeRetrieveType _Definitions – Retrieves attribute definitions.
  • AttributeRetrieveType_Values – Retrieves attribute values.This is the default.

Sub/Functions

Parameter Description
AddAttributeDefinition

Sub AddAttributeDefinition(attributeName As String)

Adds an attribute name to the list of attributes you wish to query. Multiple attributes can be added to retrieve multiple attribute values in a single query.

  • Parameters: attributeName – String representing the name of the attribute. For example: SGPCurrentTimePeriod.
  • Errors: ErrorCode.INVALID_PARAMETER – This error is thrown if the attribute name does not exist for the specified attribute class.
GetSymbolAttributeValue

Function GetSymbolAttributeValue(attributeName As String, symbolName As String, [useDefault As Boolean = True]) As String

  • Parameters:
    • attributeName – String representing the name of the symbol attribute. For example: ZGPNativeCurrency
    • symbolName – String representing the name of the symbol to retrieve the attribute value for. For example:TORONTO
    • useDefault – Optional parameter where True is the default value. When set to True, returns the default value when no specific value is set. When False, returns empty string when no value exists.
  • Errors: ErrorCode.INVALID_PARAMETER – This error is thrown if the attribute or symbol name is invalid.
GetSystemAttributeValue

Function GetSystemAttributeValue(attributeName As String, [useDefault As Boolean = True]) As String

  • Parameters:
    • attributeName – String representing the name of the system attribute. For example: SFXRates.
    • useDefault – Optional parameter where True is the default value. When set to True, returns the default value when no specific value is set. When False, returns empty string when no value exists.
  • Errors: ErrorCode.INVALID_PARAMETER – This error is thrown if the attribute name is invalid.
GetUserAttributeValue

Function GetUserAttributeValue(attributeName As String, [useDefault As Boolean = True]) As String

  • Parameters:
    • attributeName – String representing the name of the user attribute. For example: UAccSchedules
    • userName – String representing the name of the user to retrieve the attribute value for. For example: Admin
    • useDefault – Optional parameter where True is the default value. When set to True, returns the default value when no specific value is set. When False, returns empty string when no value exists.
  • Errors: ErrorCode.INVALID_PARAMETER – This error is thrown if the attribute or symbol name is invalid.
ClearDefinitions

Sub ClearDefinitions()

Removes all attribute names that have been added or loaded in the AttributeQuery.

LoadQuery

Sub LoadQuery(fileName As String)

Loads an attribute query that has been previously built and saved from the menu option: Attribute Query.

  • Parameters: fileName – String representing the full path to the query file to load. For example: C:\AttributeQuery.lvqaq.
  • Errors: ErrorCode.INVALID_PARAMETER – This error is thrown when the file cannot be loaded.
Run

Function Run() As QueryResult

Runs an attribute query and returns the results in a QueryResult class.

  • Errors: ErrorCode.INVALID_PARAMETER – This error is thrown when no symbol spec has been specified.
RunToWorksheet

Sub RunToWorksheet([worksheetName As String], [cell As String])

Runs an attribute query and places the results into the specified worksheet and cell location.

  • Parameters:

    • worksheetName – Optional string representing the name of the worksheet to place the results. If the worksheet does not exist, it will be created. If the worksheetName parameter is not specified, the current worksheet will be used.
    • cell – Optional string representing the cell location to begin the symbol query. If the cell parameter is not specified, the default cell location A1 will be used.
  • Errors: ErrorCode.INVALID_PARAMETER – This error is thrown when the query is invalid or when the specified worksheet name or cell are invalid.

Was this article helpful?

We're sorry to hear that.