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

DataQuery Class

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

Note: A symbol spec must be added for every base dimension.

Property Summary

  • Property AdjustedDetail As AdjustedDetail
  • Property ApplyFormatting As Boolean
  • Property ApplyNegativeColor As Boolean
  • Property ColumnWidth As Double
  • Property CreateNewWorksheet As Boolean
  • Property DataMode As DataMode
  • Property DataOutput As DataOutput
  • Property DecimalPlaces As Long
  • Property FormulasOutput As FormulasOutput
  • Property NegativeFormat As String
  • Property RowDescriptionWidth As Double
  • Property RowNameWidth As Double
  • Property ShowFixedSymbols As Boolean
  • Property ShowSymbolDescription As Boolean
  • Property ShowTimestamp As Boolean
  • Property Subtitle As String
  • Property Title As String
  • Property UseThousandsSeparator As Boolean
  • Property ExcludeZeros As ExcludeZeros

Sub/Function Summary

  • Sub AddColumnSpec(symbolSpec As String)
  • Sub AddRowSpec(symbolSpec As String)
  • Sub AddWorksheetSpec(symbolSpec As String)
  • Sub ClearSpecs([dimensionName As String])
  • Sub LoadQuery(fileName As String)
  • Sub RunToWorksheet([worksheetName As String], [cell As String])
  • Sub SetFixedSymbol(symbolName as String)

Properties

Parameter

Description

AdjustedDetail

Property AdjustedDetail As AdjustedDetail

Specifies whether the data query will return adjusted or unadjusted data.

  • AdjustedDetail_Adjusted – Returns adjusted data. This is the default.
  • AdjustedDetail_Unadjusted – Returns unadjusted data.

ApplyFormatting

Property ApplyFormatting As Boolean

Specifies whether the custom number formatting is applied to numbers in the results. The default value is FALSE.

If the value is set to TRUE, the values of the DecimalPlaces, UseThousandsSeparator, NegativeFormat and ApplyNegativeColor properties will be applied to numbers in the query.

ApplyNegativeColor

Property ApplyNegativeColor As Boolean

Specifies whether negative colors will be rendered in Red.  The default value is FALSE.

ColumnWidth

Property ColumnWidth As Double

Specifies the default column width for every column in the query.  The default value is 13.57 points.

CreateNewWorksheet

Property CreateNewWorksheet As Boolean

By default, a data query returns resulting data in a separate worksheet for every symbol in the Worksheet Dimension. This property specifies whether to replace an existing worksheet if the workbook already contains a worksheet with the same name.  The default value is FALSE.

DecimalPlaces

Property DecimalPlaces As Double

Specifies the number of decimals to show for each numeric data cell.  The default value is 0.

FormulasOutput

Property FormulasOutput As FormulasOutput

When DataOutput is set to DataOutput_Formulas, this property can be used to modify LVCELL() functions to use hard coded symbol names or as cell references to a cell containing the symbol name.

  • FormulasOutput_NoCellReferences – Symbol names are hard coded. This is the default.
  • FormulasOutput_CellReferences – Symbol names are replaced with cell references to the column or row heading containing the symbol name.

NegativeFormat

Property NegativeFormat As String

A number format string representing how negative numbers will be formatted. 

See Excel documentation on valid string formats.

RowDescriptionWidth

Property RowDescriptionWidth As Double

Specifies the default column width for columns representing a symbol description.  The default value is 38.14 points.

RowNameWidth

Property RowNameWidth As Double

Specifies the default column width for column representing a symbol name. The default value is 22.71 points.

ShowFixedSymbols

Property ShowFixedSymbols As String

Specifies whether a legend displaying the selections for the fixed dimensions will be displayed above the actual data.  The default value is FALSE.

ShowSymbolDescription

Property ShowTimestamp As Boolean

Specifies whether the current date/time will be displayed above the actual data. 

The default value is FALSE.

Subtitle

Property Subtitle As String

Specifies a subtitle to be displayed above the data grid and below the title.

Title

Property Title As String

Specifies a title to be displayed above the data grid.

UseThousandsSeparator

Property UseThousandsSeparator As Boolean

Specifies whether thousands separators are used when formatting numbers.

ExcludeZeros

Property ExcludeZeros As ExcludeZeros

This property is used to specify whether “zero” data will be supressed.

  • ExcludeZeros_None – No rows or columns are suppressed. This is the default.
  • ExcludeZeros_Rows – Rows where all the data returned are values of “zero” will be suppressed.
  • ExcludeZeros_Columns – Columns where all the data returned are values of “zero” will be suppressed.
  • ExcludeZeros_RowsAndColumns – Rows and columns where all the data returned are values of “zero” will be suppressed.

Sub/Functions

Parameter

Description

AddColumnSpec

Sub AddColumnSpec (symbolSpec As String)

Adds a symbol spec to the columns dimension representing the hierarchy you wish to query. You may add multiple column specs but only if the symbols are from the same dimension.

  • Parameters:

    symbolSpec – String representing a single symbol spec. For example: TRIALBAL#99.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the symbol spec is invalid or if the symbol being added has already been added in a row, worksheet or fixed dimension.

AddRowSpec

Sub AddRowSpec (symbolSpec As String)

Adds a symbol spec to the down dimension representing the hierarchy you wish to query. You may add multiple row specs but only if the symbols are from the same dimension.

  • Parameters:

    symbolSpec – String representing a single symbol spec. For example: TRIALBAL#99.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the symbol spec is invalid or if the symbol being added has already been added in a column, worksheet or fixed dimension.

AddWorksheetSpec

Sub AddWorksheetSpec (symbolSpec As String)

Adds a symbol spec representing the hierarchy you want to query.  Each symbol in the spec will be added as a separate worksheet in the current workbook.

  • Parameters:

    symbolSpec – String representing a single symbol spec. For example: TRIALBAL#99.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the symbol spec is invalid or if the symbol being added has already been added as row, column or fixed dimension.

ClearSpecs

Sub ClearSpecs([dimensionName As String])

Removes all symbol specs for the specified dimension that have been added or loaded in the Data Query.

  • Parameters:

    dimensionName – Optional string representing the dimension in which to clear.  If no dimension is specified, specs will be cleared for all dimensions.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the specified dimension name is invalid.

LoadQuery

Sub LoadQuery(fileName As String)

Loads a data query that has been previously built and saved from the menu option: Data Query.

  • Parameters:

    filename  – String representing the full path to the query file to load. For example: C:\SymbolQuery.lvqsq.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the file cannot be loaded.

RunToWorksheet

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

Runs a symbol 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.

SetFixedSymbol

Sub SetFixedSymbol (symbolName As String)

Specifies the fixed symbol name to be used when running the data query.

  • Parameters:

    symbolName – String representing the symbol name.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the symbol name is invalid or if the symbol belongs to a dimension that has already been assigned to the Row, Column or Worksheet dimensions.

Sample Usage

Sub RunDataQuery()

On Error GoTo ErrorHandler

Dim query As Longview.DataQuery

Set query = New Longview. DataQuery

query.AdjustedDetail = AdjustedDetail_Unadjusted

query.DataMode = DataMode_CTA

query.LoadQuery “C:\MyDataQuery.lvqde”

query.ClearSpecs “Entities”

query.AddRowSpec “CANADA#99”

query.SetFixedSymbol “DIM10SET”

query.RunToWorksheet “B1”

 

ErrorHandler:

If Err.Number <> 0 Then

MsgBox “Unable to run Data Query (“ & Err.Number & “) – “ &

Err.Description

End If

 

End Sub

Published:

DataQuery Class

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

Note: A symbol spec must be added for every base dimension.

Property Summary

  • Property AdjustedDetail As AdjustedDetail
  • Property ApplyFormatting As Boolean
  • Property ApplyNegativeColor As Boolean
  • Property ColumnWidth As Double
  • Property CreateNewWorksheet As Boolean
  • Property DataMode As DataMode
  • Property DataOutput As DataOutput
  • Property DecimalPlaces As Long
  • Property FormulasOutput As FormulasOutput
  • Property NegativeFormat As String
  • Property RowDescriptionWidth As Double
  • Property RowNameWidth As Double
  • Property ShowFixedSymbols As Boolean
  • Property ShowSymbolDescription As Boolean
  • Property ShowTimestamp As Boolean
  • Property Subtitle As String
  • Property Title As String
  • Property UseThousandsSeparator As Boolean
  • Property ExcludeZeros As ExcludeZeros

Sub/Function Summary

  • Sub AddColumnSpec(symbolSpec As String)
  • Sub AddRowSpec(symbolSpec As String)
  • Sub AddWorksheetSpec(symbolSpec As String)
  • Sub ClearSpecs([dimensionName As String])
  • Sub LoadQuery(fileName As String)
  • Sub RunToWorksheet([worksheetName As String], [cell As String])
  • Sub SetFixedSymbol(symbolName as String)

Properties

Parameter

Description

AdjustedDetail

Property AdjustedDetail As AdjustedDetail

Specifies whether the data query will return adjusted or unadjusted data.

  • AdjustedDetail_Adjusted – Returns adjusted data. This is the default.
  • AdjustedDetail_Unadjusted – Returns unadjusted data.

ApplyFormatting

Property ApplyFormatting As Boolean

Specifies whether the custom number formatting is applied to numbers in the results. The default value is FALSE.

If the value is set to TRUE, the values of the DecimalPlaces, UseThousandsSeparator, NegativeFormat and ApplyNegativeColor properties will be applied to numbers in the query.

ApplyNegativeColor

Property ApplyNegativeColor As Boolean

Specifies whether negative colors will be rendered in Red.  The default value is FALSE.

ColumnWidth

Property ColumnWidth As Double

Specifies the default column width for every column in the query.  The default value is 13.57 points.

CreateNewWorksheet

Property CreateNewWorksheet As Boolean

By default, a data query returns resulting data in a separate worksheet for every symbol in the Worksheet Dimension. This property specifies whether to replace an existing worksheet if the workbook already contains a worksheet with the same name.  The default value is FALSE.

DecimalPlaces

Property DecimalPlaces As Double

Specifies the number of decimals to show for each numeric data cell.  The default value is 0.

FormulasOutput

Property FormulasOutput As FormulasOutput

When DataOutput is set to DataOutput_Formulas, this property can be used to modify LVCELL() functions to use hard coded symbol names or as cell references to a cell containing the symbol name.

  • FormulasOutput_NoCellReferences – Symbol names are hard coded. This is the default.
  • FormulasOutput_CellReferences – Symbol names are replaced with cell references to the column or row heading containing the symbol name.

NegativeFormat

Property NegativeFormat As String

A number format string representing how negative numbers will be formatted. 

See Excel documentation on valid string formats.

RowDescriptionWidth

Property RowDescriptionWidth As Double

Specifies the default column width for columns representing a symbol description.  The default value is 38.14 points.

RowNameWidth

Property RowNameWidth As Double

Specifies the default column width for column representing a symbol name. The default value is 22.71 points.

ShowFixedSymbols

Property ShowFixedSymbols As String

Specifies whether a legend displaying the selections for the fixed dimensions will be displayed above the actual data.  The default value is FALSE.

ShowSymbolDescription

Property ShowTimestamp As Boolean

Specifies whether the current date/time will be displayed above the actual data. 

The default value is FALSE.

Subtitle

Property Subtitle As String

Specifies a subtitle to be displayed above the data grid and below the title.

Title

Property Title As String

Specifies a title to be displayed above the data grid.

UseThousandsSeparator

Property UseThousandsSeparator As Boolean

Specifies whether thousands separators are used when formatting numbers.

ExcludeZeros

Property ExcludeZeros As ExcludeZeros

This property is used to specify whether “zero” data will be supressed.

  • ExcludeZeros_None – No rows or columns are suppressed. This is the default.
  • ExcludeZeros_Rows – Rows where all the data returned are values of “zero” will be suppressed.
  • ExcludeZeros_Columns – Columns where all the data returned are values of “zero” will be suppressed.
  • ExcludeZeros_RowsAndColumns – Rows and columns where all the data returned are values of “zero” will be suppressed.

Sub/Functions

Parameter

Description

AddColumnSpec

Sub AddColumnSpec (symbolSpec As String)

Adds a symbol spec to the columns dimension representing the hierarchy you wish to query. You may add multiple column specs but only if the symbols are from the same dimension.

  • Parameters:

    symbolSpec – String representing a single symbol spec. For example: TRIALBAL#99.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the symbol spec is invalid or if the symbol being added has already been added in a row, worksheet or fixed dimension.

AddRowSpec

Sub AddRowSpec (symbolSpec As String)

Adds a symbol spec to the down dimension representing the hierarchy you wish to query. You may add multiple row specs but only if the symbols are from the same dimension.

  • Parameters:

    symbolSpec – String representing a single symbol spec. For example: TRIALBAL#99.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the symbol spec is invalid or if the symbol being added has already been added in a column, worksheet or fixed dimension.

AddWorksheetSpec

Sub AddWorksheetSpec (symbolSpec As String)

Adds a symbol spec representing the hierarchy you want to query.  Each symbol in the spec will be added as a separate worksheet in the current workbook.

  • Parameters:

    symbolSpec – String representing a single symbol spec. For example: TRIALBAL#99.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the symbol spec is invalid or if the symbol being added has already been added as row, column or fixed dimension.

ClearSpecs

Sub ClearSpecs([dimensionName As String])

Removes all symbol specs for the specified dimension that have been added or loaded in the Data Query.

  • Parameters:

    dimensionName – Optional string representing the dimension in which to clear.  If no dimension is specified, specs will be cleared for all dimensions.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the specified dimension name is invalid.

LoadQuery

Sub LoadQuery(fileName As String)

Loads a data query that has been previously built and saved from the menu option: Data Query.

  • Parameters:

    filename  – String representing the full path to the query file to load. For example: C:\SymbolQuery.lvqsq.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the file cannot be loaded.

RunToWorksheet

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

Runs a symbol 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.

SetFixedSymbol

Sub SetFixedSymbol (symbolName As String)

Specifies the fixed symbol name to be used when running the data query.

  • Parameters:

    symbolName – String representing the symbol name.

  • Errors:

    ErrorCode.INVALID_PARAMETER – This error is thrown when the symbol name is invalid or if the symbol belongs to a dimension that has already been assigned to the Row, Column or Worksheet dimensions.

Sample Usage

Sub RunDataQuery()

On Error GoTo ErrorHandler

Dim query As Longview.DataQuery

Set query = New Longview. DataQuery

query.AdjustedDetail = AdjustedDetail_Unadjusted

query.DataMode = DataMode_CTA

query.LoadQuery “C:\MyDataQuery.lvqde”

query.ClearSpecs “Entities”

query.AddRowSpec “CANADA#99”

query.SetFixedSymbol “DIM10SET”

query.RunToWorksheet “B1”

 

ErrorHandler:

If Err.Number <> 0 Then

MsgBox “Unable to run Data Query (“ & Err.Number & “) – “ &

Err.Description

End If

 

End Sub

For an optimal Community experience, Please view on Desktop