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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
ClearSpecs | Sub ClearSpecs([dimensionName As String]) Removes all symbol specs for the specified dimension that have been added or loaded in the Data Query.
|
LoadQuery | Sub LoadQuery(fileName As String) Loads a data query that has been previously built and saved from the menu option: Data Query.
|
RunToWorksheet | Sub RunToWorksheet([worksheetName As String], [cell As String]) Runs a symbol query and places the results into the specified worksheet and cell location.
|
SetFixedSymbol | Sub SetFixedSymbol (symbolName As String) Specifies the fixed symbol name to be used when running the data query.
|
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 |