Dashboards

DynamicGrid and SQL Table Editor

DynamicGrid components display tabular data from SQL adapters in an editable grid. Users can modify cell values directly in the grid, then save changes back to the database through a Dashboard Extender Business Rule. This makes DynamicGrids the go-to component for data entry interfaces, planning input forms, and administration screens.

DynamicGrid Setup

A DynamicGrid requires two pieces:
  1. SQL Data Adapter — Provides the data to display in the grid
  2. Dashboard Extender BR — Handles the save operation when the user clicks a Save button

SQL Adapter for DynamicGrid

The SQL adapter query defines what data appears in the grid. Each column in the result set becomes a grid column. The query can include |!Param!| substitution for parameter-driven filtering.
plaintext
1SELECT
2  Id,
3  Account,
4  Entity,
5  Period,
6  Amount,
7  Notes
8FROM dbo.PlanningInput
9WHERE Scenario = '|!ScenarioParam!|'
10AND Entity = '|!EntityParam!|'
11ORDER BY Account, Period
ℹ️Info
Include a primary key column (like Id) in the query. The DynamicGrid uses it to track which rows have been inserted, updated, or deleted when the user saves.

DynamicGrid Properties

PropertyDescription
Data AdapterSQL adapter providing the grid data
IsEnabledWhether the grid cells are editable
AllowInsertWhether users can add new rows
AllowDeleteWhether users can delete rows
DisplayFormatGrid appearance settings

The Save Workflow

When the user edits cells and clicks a Save button, the DynamicGrid sends the modified data to a Dashboard Extender BR with FunctionType = SqlTableEditorSaveData. The BR processes the changes and returns a result indicating success or failure.
diagramDynamicGrid Save Workflow

Loading diagram...

Save Handler Business Rule

The save handler receives the edited data through args.SqlTableEditorSaveDataTaskInfo and returns a result through XFSqlTableEditorSaveDataTaskResult.

XFSqlTableEditorSaveDataTaskInfo Properties

PropertyDescription
SqlTableEditorDefinitionThe SQL Table Editor definition containing table name, view name, and configuration
ColumnsList of XFDataColumn objects describing the table columns
HasPrimaryKeyColumnsWhether the table has primary key columns defined for tracking changes
EditedDataRowsList of XFEditedDataRow objects containing the modified rows. Each row has an InsertUpdateOrDelete property (0=Insert, 1=Update, 2=Delete) and ModifiedDataRow with the changed values.
CustomSubstVarsCustom substitution variables passed from the dashboard

XFSqlTableEditorSaveDataTaskResult Properties

PropertyDescription
IsOKTrue if the save was successful, False otherwise
ShowMessageBoxWhether to display a message box to the user after saving
MessageThe message text to display
CancelDefaultSaveWhen True, prevents the default save behavior (use when you handle all persistence in the BR)

Save Handler Example

1If args.FunctionType = DashboardExtenderFunctionType.SqlTableEditorSaveData Then
2  Dim saveInfo As XFSqlTableEditorSaveDataTaskInfo = args.SqlTableEditorSaveDataTaskInfo
3  Dim editedRows As List(Of XFEditedDataRow) = saveInfo.EditedDataRows
4  Dim result As New XFSqlTableEditorSaveDataTaskResult()
5
6  Try
7      Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
8          For Each editedRow As XFEditedDataRow In editedRows
9              Select Case editedRow.InsertUpdateOrDelete
10                  Case 0 ' Insert
11                      Dim sql As String = String.Format(
12                          "INSERT INTO dbo.PlanningInput (Account, Entity, Period, Amount, Notes) VALUES ('{0}', '{1}', '{2}', {3}, '{4}')",
13                          editedRow.ModifiedDataRow("Account"), editedRow.ModifiedDataRow("Entity"), editedRow.ModifiedDataRow("Period"), editedRow.ModifiedDataRow("Amount"), editedRow.ModifiedDataRow("Notes"))
14                      BRApi.Database.ExecuteSql(dbConnApp, sql, False)
15
16                  Case 1 ' Update
17                      Dim sql As String = String.Format(
18                          "UPDATE dbo.PlanningInput SET Amount = {0}, Notes = '{1}' WHERE Id = {2}",
19                          editedRow.ModifiedDataRow("Amount"), editedRow.ModifiedDataRow("Notes"), editedRow.ModifiedDataRow("Id"))
20                      BRApi.Database.ExecuteSql(dbConnApp, sql, False)
21
22                  Case 2 ' Delete
23                      Dim id As Integer = CInt(editedRow.ModifiedDataRow("Id"))
24                      Dim sql As String = String.Format("DELETE FROM dbo.PlanningInput WHERE Id = {0}", id)
25                      BRApi.Database.ExecuteSql(dbConnApp, sql, False)
26              End Select
27          Next
28      End Using
29
30      result.IsOK = True
31      result.ShowMessageBox = True
32      result.Message = "Data saved successfully."
33      result.CancelDefaultSave = True
34  Catch ex As Exception
35      result.IsOK = False
36      result.ShowMessageBox = True
37      result.Message = "Save failed: " & ex.Message
38      result.CancelDefaultSave = True
39  End Try
40
41  Return result
42End If

End-to-End Architecture

diagramDynamicGrid End-to-End Architecture

Loading diagram...

The full setup involves:
  1. A custom SQL table (e.g., dbo.PlanningInput) holding the editable data
  2. A SQL data adapter querying that table with |!Param!| filters
  3. A DynamicGrid component bound to the adapter
  4. A Save button with SelectionChangedServerTask = ExecuteDashboardExtenderBusinessRule
  5. A Dashboard Extender BR handling the SqlTableEditorSaveData function type