×
Menu
Index

9.1.6. ChronoExtDBViewer

 
The ChronoExtDBViewer object controls the External Data Viewer panel (v1.0.2.61 or greater): opens one of the views configured in the panel with the values of the current document as parameters, reads the rows shown, runs the insert, update and delete statements of the view and styles the cells.
It is available in every script.
 
Methods
Returns
Method
Description
short
AddStyleClass
(long row, long col, string styleclass)
Since v1.0.2.96
Adds a style class to the specified cell by row and column indexes
Parameters
row (long): row index (0 based)
col (long): Column index (0 based)
styleclass (string): The style class to set
Allowed values: default, primary, success, info, warning, danger
Returns: 1 = Success, 0 = Fail
Example: see example 1 at the end of this page.
void
ClearCurrentView
()
Since v1.0.2.92
Clear the data on the current view displaying on the External Data Viewer Panel.
void
CloseCurrentView
()
Since v1.0.2.61
Closes the current view on display on the External Data Viewer Panel. The panel will become blank.
Example
'Close current extarnal data viewer, if any opened
Call ChronoExtDBViewer.CloseCurrentView()
string
CurrentSelectedGetFieldValue
(string FieldName)
Since v1.0.2.69
Returns the value of a specified column from the selected row of the external data viewer
Parameters
FieldName (string): The column name of the selected table row
Example
Call ChronoExtDBViewer.CurrentSelectedGetFieldValue("Your column name")
short
DeleteSelectedRows
(string ViewName)
Deletes the currently selected row on the External Data Viewer Panel.
Parameters:
ViewName -  The name of the view as setup inside the External Data Viewer Panel Configuration
short
ExecuteInsert
(string ViewName, string INPARAM_1 = "", string INPARAM_2 = "", string INPARAM_3 = "", string INPARAM_4 = "", string INPARAM_5 = "", string INPARAM_6 = "", string INPARAM_7 = "", string INPARAM_8 = "", string INPARAM_9 = "")
Since v1.0.2.61
This runs the Insert statement set inside the External Data Viewer Panel Configuration.
Make sure to fill in all of the required parameters for your desired view.
Parameters
ViewName (string): The name of the view as setup inside the External Data Viewer Panel Configuration
INPARAM_1 (string) optional
INPARAM_2 (string) optional
INPARAM_3 (string) optional
INPARAM_4 (string) optional
INPARAM_5 (string) optional
INPARAM_6 (string) optional
INPARAM_7 (string) optional
INPARAM_8 (string) optional
INPARAM_9 (string) optional
Returns: 1 = True, 0 = False
Example
Call ChronoExtDBViewer.ExecuteInsert("Your view name", param1, param2)
short
ExecuteUpdate
(string ViewName, string INPARAM_1 = "", string INPARAM_2 = "", string INPARAM_3 = "", string INPARAM_4 = "", string INPARAM_5 = "", string INPARAM_6 = "", string INPARAM_7 = "", string INPARAM_8 = "", string INPARAM_9 = "", string INPARAM_10 = "")
Since v1.0.2.96
This runs the Update statement set inside the External Data Viewer Panel Configuration. Make sure to fill in all of the required parameters for your desired view.
Parameters
ViewName (string): The name of the view as setup inside the External Data Viewer Panel Configuration
INPARAM_1 (string) optional
INPARAM_2 (string) optional
INPARAM_3 (string) optional
INPARAM_4 (string) optional
INPARAM_5 (string) optional
INPARAM_6 (string) optional
INPARAM_7 (string) optional
INPARAM_8 (string) optional
INPARAM_9 (string) optional
INPARAM_10 (string) optional
Returns: 1 = True, 0 = False
Example
Call ChronoExtDBViewer.ExecuteUpdate("Your view name", param1, param2)
double
GetCellValueNumeric
(long row, long col)
Since v1.0.2.96
Returns the specified cell value as a numeric double
Parameters
row (long): row index (0 based)
col (long): Column index (0 based)
Returns: Returns 0 if non-numeric
Example: see example 1 at the end of this page.
string
GetCellValueString
(long row, long col)
Since v1.0.2.96
Returns the specified cell value as a string
Parameters
row (long): row index (0 based)
col (long): Column index (0 based)
Returns: Returns "" for NULL values
Example: see example 1 at the end of this page.
long
GetColCount
()
Since v1.0.2.95
Returns the number of columns of the external data viewer table.
Example: see example 1 at the end of this page.
long
GetColIndex
(string colname)
Since v1.0.2.96
Returns the specified column index
Parameters
colname (string): Column index (0 based)
Returns: -1 if no column found
Example: see example 1 at the end of this page.
string
GetColName
(long col)
Since v1.0.2.96
Returns the specified column name
Parameters
col (long): Column index (0 based)
Returns: column name or "No data"
Example: see example 1 at the end of this page.
string
GetColType
(long col)
Since v1.0.2.95
Returns the specified column type
Parameters
col (long): Column index (0 based)
Returns: Column type; either "numeric", "string", "No data" or ""
Example: see example 1 at the end of this page.
string
GetLastError
()
Return the last error message.
long
GetRowCount
()
Since v1.0.2.95
Returns the number of rows of the external data viewer table.
Example: see example 1 at the end of this page.
string
Input1GetValue
()
Since v1.0.2.74
Returns the value of the external data viewer input1 text field
Example
val = ChronoExtDBViewer.Input1GetValue()
void
Input1SetValue
(string value)
Since v1.0.2.92
Sets the value for the the external data viewer input1 text field
Parameters
value (string): The value to set
Example
Call ChronoExtDBViewer.Input1SetValue("New value to set")
void
OpenView
(string ViewName, string INPARAM_1 = "", string INPARAM_2 = "", string INPARAM_3 = "", string INPARAM_4 = "", string INPARAM_5 = "", string INPARAM_6 = "", string INPARAM_7 = "", string INPARAM_8 = "", string INPARAM_9 = "")
Since v1.0.2.61
This runs the Select statement set inside the External Data Viewer Panel Configuration.
Make sure to fill in all of the required parameters for your desired view.
The result of the statement will show up on the External Data Viewer Panel.
Parameters
ViewName (string): The name of the view as setup inside the External Data Viewer Panel Configuration
INPARAM_1 (string) optional
INPARAM_2 (string) optional
INPARAM_3 (string) optional
INPARAM_4 (string) optional
INPARAM_5 (string) optional
INPARAM_6 (string) optional
INPARAM_7 (string) optional
INPARAM_8 (string) optional
INPARAM_9 (string) optional
Example
'Open a configured external data viewer panel
'In this example we have a select statement filtering by a supplier id provided by a job field
Call ChronoExtDBViewer.OpenView("Your view name", UserField_Supplier.value)
short
RemoveStyleClass
(long row, long col)
Since v1.0.2.96
Removes any style class a cell has
Parameters
row (long): row index (0 based)
col (long): Column index (0 based)
Returns: 1 = Success, 0 = Fail
Example: see example 1 at the end of this page.
 
Examples
Example 1 (AddStyleClass, GetCellValueNumeric, GetCellValueString, GetColCount, GetColIndex, GetColName, GetColType, GetRowCount, RemoveStyleClass)
Dim ret
Dim row
Dim col
Dim column_type
Dim column_name
Dim numeric_val
Dim string_val
Dim compare_val
compare_val = 5.5
Dim string_to_find
string_to_find = "JOHN DOE"
Dim err_log
 
Dim TOTAL_ROWS
TOTAL_ROWS = ChronoExtDBViewer.GetRowCount()
Dim TOTAL_COLS
TOTAL_COLS = ChronoExtDBViewer.GetColCount()
 
' iterating data viewer results table
For row = 0 To TOTAL_ROWS-1
 
        ' logging output for each row
        ' ChronoApp.AddToOutputWindow("Iterating Row " & row)
 
        For col = 0 To TOTAL_COLS-1
 
                ' getting the column name
                column_name = ChronoExtDBViewer.GetColName(col)
                ' getting every column type
                column_type = ChronoExtDBViewer.GetColType(col)
                ' logging output for each column
                ' ChronoApp.AddToOutputWindow("Iterating Row " & row & ", column " & col & ", column name: " & column_name & ", column type:" & column_type)
 
                If column_type = "numeric" Then
 
                    ' doing something with a numeric value
                    numeric_val = ChronoExtDBViewer.GetCellValueNumeric(row, col)
                    If numeric_val < compare_val Then
                        ' if cell value lower than compare value we set a red background to the cell, for example
                        ret = ChronoExtDBViewer.AddStyleClass(row, col, "danger")
        End If
 
        Else
 
    ' doing something with a string value
    string_val = ChronoExtDBViewer.GetCellValueString(row, col)
    If string_val = string_to_find Then
                        ' if cell value contains the string we are looking for, we set a green background, for example
                        ret = ChronoExtDBViewer.AddStyleClass(row, col, "success")
                End If
 
                End If
 
        Next
 
Next