-
Notifications
You must be signed in to change notification settings - Fork 4
(Use case) Switch text with a PLC variable
- Automation Studio 4.5
- mappView 5.9
This -->sample<-- shows how to dynamically change a text in mappView depending on a PLC variable. The text is located in a text file which allows you to switch between languages. The sample is based on the mappView help (11eb265c-2891-41d9-a2bf-4f4810269bab)
- Add a project language to your project if it does not already exist
- Add a text snippet file
- Add a localized text file
Open the localized text file and a few lines. Change the namespace to "IAT" and make sure the Text ID is Status followed by a dot and a number.
Open the snippet file, define a snippet set id and add a snippet line for text.
<?xml version="1.0" encoding="utf-8"?>
<SnippetsSet id="TextSnippets" xmlns="http://www.br-automation.com/iat2015/snippet/engineering/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Snippets>
<Snippet id="SnippetStatus" xsi:type="session" type="IndexText" formatItem="Status.{1}" />
</Snippets>
</SnippetsSet>
Open the page where the status text should be displayed. Add a new text output and name it "StatusTextOutput"
Go to the physical view and open the *.vis file. Add the snippet set to the configuration.
<SnippetsSets>
<SnippetsSet refId="TextSnippets"/>
</SnippetsSets>
Open the binding file that belongs to the content page or create a new binding file and add the following bindings. The first binding connects that PLC variable TestVar1 to the snippet. The second binding connects the snippet to the text output widget.
<Binding mode="oneWay">
<Source xsi:type="opcUa" refId="::AsGlobalPV:TestVar1" attribute="value"/>
<Target xsi:type="snippet" refId="SnippetStatus" attribute="value"/>
</Binding>
<Binding mode="oneWay">
<Source xsi:type="snippet" refId="SnippetStatus" attribute="value" />
<Target xsi:type="brease" widgetRefId="StatusTextOutput" contentRefId="contentStart" attribute="value" />
</Binding>
Make sure that the text file create in the first step is added to the text system in the configuration view. Add a text system configuration if it does not exist.
General Information
Direct binding
Event binding
Use cases
- General
- Widgets
- Styles
- Text
- Content