Overview
This Tutorial will introduce the concept of TagProvider, which allows tagless connections with external and dynamic data sources.
In this application, we will connect to an MQTT broker and a generic display that will show information about the selected element. This solution won't create any local tags; everything will be executed with dynamic connections.
On this page:
Requirements
This tutorial assumes that the basic Solution Configuration tutorial has already been executed.
Therefore, the detailed description of some operations, like creating new solutions, won't be included in this tutorial.
Configuration Outline
- Create a New Solution.
- Start The Broker and the MQTT Simulator, at Data Explorer.
- At AssetsTree, create a MQTT TagProvider.
- Add the MQTT data to to an AssetNode.
- Create a screen with:
- AssetTree
- Trend Chart
- DataGrid
- UI Controls
Configuration Steps
Create a new Solution
At the Solutions Manager tool, create a new solution, using HeaderLayout.
Using the Data Explorer MQTT Tools
Go to Data Explorer / MQTT Tools. Start the MQTT and the MQTT Simulator.
Once you've done so, click Connect to see and browse the generated data.
TagProvider connection with MQTT Broker
- Go to Unified Namespace > Asset Tree
- Create a new TagProvider. Either by the Toolbar Icon, or via menu File-New-TagProvider. Keep the provider MQTT and all default settings.
- Right click at the RootTags Folder. At the context menu, execute New AssetFolder.
- Right click at the folder just created and execute 'Insert Asset from TagProvider'. Select GroupID as the initial node to insert.
At this point, you already have the data from the broker integrated with your AssetTree.
Display With AssetTree and UI Controls
- Go to Draw and select the MainPage.
- Insert a TAssetsTree component (Located under the Modules section of the list of components). No configuration required, the default settings are what we need.
- Add a TextBox (icon) using the vertical toolbar. Add the value Client.SelectedAsset to the LinkedValue property, and the Label text to AssetPath.
- Add a TextBox (icon) using the vertical toolbar. Add the value Asset(Client.SelectedAsset) to the linked value to AssetValue, and modify the Label text to Value.
- Add a DataGrid and configure the DataSource to Client.SelectedAsset.
- Add a TrendChat, and map the first pen, using Client.SelectAsset for the TagName.
Running the Solution
Go to Runtime / Startup and press the START button, or use the top menu to execution, by going to Action / Startup.
The RichClient will execute and will show the AssetTree. As you navigate on the tree, some fields will have a new value, the ones mapped to Client.SelectedAsset.
In this section: