Datasets Tables (Reference) provide direct table-level database operations with automatic CRUD functionality and tag mapping. DatasetTable enables:
- Direct table access without SQL
- Automatic INSERT, UPDATE, DELETE operations
- Row-to-tag mapping
- WhereCondition filtering
- Access control management
- Batch operations
Tables simplify database interactions by eliminating manual SQL for common operations.
In this page:
Table of Contents maxLevel 2 minLevel 2 indent 10px exclude Steps style none
Configuration Properties
Property | Description | Required |
---|---|---|
Name | Unique table identifier (no spaces) | Yes |
DB | Database connection | Yes |
TableName | Actual database table name | Yes |
WhereCondition | Filter clause for operations | No |
Access | Permission level (Read/Insert/ReadWrite/Unrestricted) | Yes |
Mapping | Tag-to-column assignments | No |
MappingDateTime | Time interpretation (UTC/Local) | No |
Description | Documentation text | No |
Creating Tables
- Navigate to Datasets → Tables
- Click Plus icon
- Configure:
- Name: Unique identifier (use underscores)
- Description: Documentation
- Click OK
- Set properties:
- DB: Select database
- TableName: Target table
- Access: Permission level
Access Levels
Level | Permissions | Use Case |
---|---|---|
Read | SELECT only | Viewing data |
Insert | INSERT only | Adding records |
ReadWrite | SELECT, INSERT, UPDATE, DELETE | Full CRUD |
Unrestricted | All operations + ALTER | Development only |
WhereCondition Configuration
Filter data using SQL WHERE syntax:
Static Conditions
sql
Status = 1
Department = 'Production'
Timestamp > '2024-01-01'
Dynamic with Tags
sql
BatchID = {Tag.Production/Batch_ID}
Temperature > {Tag.TankFarm/Tank1/Temp}
Operator = '{Tag.Current_Operator}'
Complex Conditions
sql
Status IN (1, 2, 3)
AND Department = '{Tag.Department}'
AND Timestamp > {Tag.StartDate}
Tag Mapping
Configuration
- Click Mapping ellipsis (...)
- Assign columns to tags:
Column | Tag | Usage |
---|---|---|
ID | Tag.RecordID | Primary key |
Name | Tag.ProductName | Display value |
Count | Tag.Quantity | Numeric data |
Status | Tag.Status | State tracking |
Mapping Behavior
- First row mapped on SELECT
- All rows available via DataTable
- Bidirectional for updates
- Auto-refresh on changes
Execution Methods
Select Operations
csharp
// Trigger select
@Dataset.Table.ProductionTable.Select = true;
// Get all results
DataTable data = @Dataset.Table.ProductionTable.SelectCommand();
// Check row count
int rows = @Dataset.Table.ProductionTable.RowCount;
Insert Operations
csharp
// Set values in mapped tags
@Tag.ProductName = "Widget-A";
@Tag.Quantity = 100;
@Tag.Status = 1;
// Execute insert
@Dataset.Table.ProductionTable.Insert = true;
Update Operations
csharp
// Modify mapped tags
@Tag.Quantity = 150;
@Tag.Status = 2;
// Execute update (uses WhereCondition)
@Dataset.Table.ProductionTable.Update = true;
Delete Operations
csharp
// Set identifying values
@Tag.RecordID = 12345;
// Execute delete (uses WhereCondition)
@Dataset.Table.ProductionTable.Delete = true;
Advanced Operations
Batch Processing
csharp
public void BatchUpdate()
{
DataTable table = @Dataset.Table.MyTable.SelectCommand();
foreach(DataRow row in table.Rows)
{
row["Status"] = "Processed";
row["ProcessDate"] = DateTime.Now;
}
// Update all modified rows
@Dataset.Table.MyTable.UpdateCommand(table);
}
Dynamic WhereCondition
csharp
// Change filter at runtime
@Dataset.Table.MyTable.WhereCondition =
string.Format("Date = '{0}'", DateTime.Today);
// Execute with new filter
@Dataset.Table.MyTable.Select = true;
Transaction Support
csharp
try
{
@Dataset.BeginTransaction();
@Dataset.Table.Table1.Insert = true;
@Dataset.Table.Table2.Update = true;
@Dataset.CommitTransaction();
}
catch
{
@Dataset.RollbackTransaction();
}
DateTime Handling
MappingDateTime Options
Setting | Behavior | Use Case |
---|---|---|
Local | Convert to local time | User displays |
UTC | Keep as UTC | Server operations |
Example Configuration
csharp
// Store as UTC, display as local
@Dataset.Table.EventLog.MappingDateTime = "UTC";
// Tag receives UTC, display converts
@Tag.EventTime = // Automatically converted
Display Integration
DataGrid Binding
xml
<DataGrid DataSource="{Dataset.Table.ProductionTable}" />
ComboBox Population
csharp
// Fill combo with table data
@Display.ComboBox.DataSource =
@Dataset.Table.LookupTable.SelectCommand();
Best Practices Checklist
- Use WhereCondition - Filter at database level
- Set appropriate Access - Minimum required permissions
- Map key columns - For updates and deletes
- Handle nulls - Check before operations
- Use transactions - For related updates
- Limit result sets - Add TOP/LIMIT in WhereCondition
- Index columns - Used in WhereCondition
Performance Tips
Optimize WhereCondition
sql
-- Use indexed columns
ID = {Tag.ID} -- Good if ID is indexed
-- Avoid functions on columns
YEAR(Date) = 2024 -- Bad
Date >= '2024-01-01' AND Date < '2025-01-01' -- Good
Batch Operations
csharp
// Instead of multiple single updates
for(int i = 0; i < 100; i++)
{
@Tag.ID = i;
@Dataset.Table.MyTable.Update = true; // Slow
}
// Use batch update
DataTable batch = PrepareData();
@Dataset.Table.MyTable.UpdateCommand(batch); // Fast
Troubleshooting
No data returned:
- Check WhereCondition syntax
- Verify table exists
- Confirm permissions
- Test in SQL tool
Insert/Update fails:
- Check Access level
- Verify required columns
- Review data types
- Check constraints
Mapping not working:
- Confirm column names
- Check tag types match
- Verify tag exists
- Review case sensitivity
Performance issues:
- Add database indexes
- Limit WhereCondition scope
- Use pagination
- Check network latency
In this section...
Page Tree | ||||
---|---|---|---|---|
|
Overview
The Dataset Tables section in the Dataset Module simplifies data table management. Customize structure, relationships, and data types through an intuitive interface that streamlines data handling and promotes efficient data management.
Tables
To create and configure a Database Table follow these steps:
- Access Datasets / Tables.
- Click the plus icon.
Enter a Name and Description for the table.
- Click Ok.
Info |
---|
The use of spaces is not allowed in the Name. Instead, use underscores. For example: My_Table |
To edit a Dataset Table, double-click the property you wish to edit on the row corresponding to the table you want to modify on the data grid. The table below describes each available property.
Column
Description
Name
The Table's name inside the plataform solution.
DB
Defines the database connected to the Table.
Table Name
The Table's name in the Database you want to access.
WhereCondition
Specify the parameters that will filter the data using SQL syntax. For example: "ColumnName = {tag.tagInt}
".
Access
Defines the access permissions for the table.
Mapping
Click the button with three dots (...) to select the tags that you want to populate with data in the first row of the table with data from specific columns.
MappingDateTime
Specify how the time in Database will be interpreted (UTC or Local), when mapping to DateTimeOffset .NET variables, or to Tags in the application using the Mapping column.
Description
Table's description.
Datasets Table Columns
DatasetTable Properties | |
---|---|
ID | Identifies the unique identifier for the DatasetTable. |
VersionID | Shows the specific version number of the DatasetTable. |
Name | Names the DatasetTable configuration for identification and reference. |
DB | Specifies the database to which the table configuration connects. |
TableName | Defines the name of the database table being accessed or modified. |
WhereCondition | Sets the conditions that filter or limit the rows affected by the operation. |
Access | Specifies the access level required to interact with the table configuration. Read: Grants permission to view or retrieve data from the table. Users can select and read rows based on specified conditions but cannot modify, insert, or delete any data. Insert: Allows users to add new rows to the table. Users can insert data into the table but cannot update, delete, or read existing rows. ReadWrite: Provides full access to the table, allowing users to read, insert, update, and delete data. This option enables complete interaction with the table, covering all CRUD (Create, Read, Update, Delete) operations. Unrestricted: Removes all access limitations, allowing users to perform any action on the table, including reading, inserting, updating, deleting, and even altering the table's structure if necessary. |
Mapping | Links the operation's input or output to tag values or variables. |
DateTimeMode | Specifies how date and time values are handled in the table configuration. Include Local and UTC options. |
Level | Classifies the table configuration within a specific level or hierarchy. |
Category | Groups the table configuration within a specific category for organization. |
LockState | Indicates whether the table configuration is locked and cannot be modified. |
LockOwner | Identifies the owner responsible for locking the table configuration. |
DateCreated | Records the date and time when the table configuration was created. |
DateModified | Records the date and time when the table configuration was last modified. |
Description | Summarizes the purpose and details of the table configuration. |
In this section:
Page Tree | ||||
---|---|---|---|---|
|