- Solution Name: Get Data From Asset
- Software Version
- : v10
- Keywords: Unified Namespace. AssetTree. TagProvider. MQTT. Data Explorer Tools.
Summary
This solution example demonstrates how to populate a DataGrid with information stored in databases.
Technical Information
The Dataset enables connecting to an existing external Database. Different providers can be used and can be simply and quickly configured.
To each external Database the Module Database will communicate, a connection needs to be created with certain parameters. Each connection, created on Datasets → DBs is called this as Dataset DB.
When using SQLite Databases, the Dataset can automatically create the Database if necessary; for other ones, the Database itself must already exist before you set your connection. Users with any Permission groups can create new connections in the solution, but only the Administrator can configure Databases password logins.
To fill the DataGrid, first load an SQLite database under Datasets → DBs. After that, map the data by navigating to Datasets → Tables, using pre-existing Tags along with the "Mapping Name," database, and table name.
Additionally, the Tables tab can be useful for specifying which data is selected through the WhereCondition column. You can also modify access permissions to the table, allowing the client to either Read and Write information, or just Read.
use a MQTT Broker as a connector between a TagProvider and the solution.
Technical Information
The MQTT Broker in this solution acts as a communicator between a TagProvider (in this example the MQTT Publisher Simulator) and the solution, by creating a new Asset Tree inside the UNS. The Tags within this Asset Tree can be accessed by the system and displayed to the user via the path used in the text boxes shown below.
Users can also dynamically access Tags through user input by utilizing the Client.Context.AssetName
client tag in the SelectedAsset configuration within the Asset Tree component. This client tag stores the value of the selected asset, which can be accessed and used via Asset(Client.Context.AssetName)
.
The information in the new Asset Tree can be moved or copied to other parts of the solution for easier manipulation. For example, to associate a DataTable called DT
with the Tags from the TagProvider, a script class named ChildrenHandler
(accessible under Script / Classes) was created. Within this class, a function called GetAssetTable
is defined. This function is invoked in the code-behind section of the main display to link the DT
DataTable with the Tags in the new Asset Tree.
Reference Information
→ See UNS TagProvider Connections
Reference Information
→ See Datasets (SQL Queries) for more information.
In this section:
Page Tree | ||||
---|---|---|---|---|
|