Data Table Query Class
Download Add-in for Office Guide
The Data Table Query class represents a data table query created using the Data Table Query menu option. You can use the properties and methods of this class to create a new data table query, modify an existing query, and output the query results to a Microsoft Excel worksheet.
Property Summary
- Property ApplyFormatting As Boolean
- Property ApplyNegativeColor As Boolean
- Property DecimalPlaces As Long
- Property NegativeFormat As String
- Property SymbolOutput as SymbolOutput
- Property TableName As String
- Property UseThousandsSeparator As Boolean
Sub/Function Summary
- Sub AddColumn(columnName as String, [decimalPlaces as Long])
- Sub ClearColumns()
- Sub LoadQuery(queryFileName as String)
- Sub RunToWorksheet([worksheetName as String], [cell As String])
Properties
| Parameter | Description |
|---|---|
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. |
DecimalPlaces |
Property DecimalPlaces As Long Specifies the number of decimals to show for each numeric data cell. The default value is 0. Valid values range from 0 to 9. |
NegativeFormat |
Property NegativeFormat As String A number format string representing how negative numbers will be formatted. See Excel documentation on valid string formats. |
SymbolOutput |
Property SymbolOutput As SymbolOutput Specifies whether the query results include symbol name, symbol description or both.
|
TableName |
Specifies the name of the data table to query. The value must match the name of an existing data table in the Longview application. |
UseThousandsSeparator |
Property UseThousandsSeparator As Boolean Specifies whether thousands separators are used when formatting numbers. |
Sub/Functions
| Parameter | Description |
|---|---|
AddColumn |
Sub AddColumn(columnName As String, [decimalPlaces As Long]) Adds a column to the data table query. Parameters:
Errors:
|
ClearColumns |
Sub ClearColumns() Removes all currently selected columns from the data table query. This method does not remove the selected data table or any other query settings. |
LoadQuery |
Sub LoadQuery(queryFileName As String) Loads a previously saved data table query. Parameters:
Errors:
|
RunToWorksheet |
Sub RunToWorksheet([worksheetName As String], [cell As String]) Runs the data table query and inserts the results into the specified worksheet and starting cell. Parameters:
Errors:
|
Sample Usage:
Dim query As Longview.DataTableQuery
Set query = New Longview.DataTableQuery
query.TableName = "LVAPP_TASKS"
query.ApplyFormatting = True
query.DecimalPlaces = 0
query.UseThousandsSeparator = True
query.NegativeFormat = "(1234)"
query.ApplyNegativeColor = True
query.SymbolOutput = SymbolOutput_NameAndDescription
query.AddColumn("ID")
query.AddColumn("Amount", 2)
query.RunToWorksheet("TasksWorksheet", "B2")