Indexed Text / Multistate Indicators in mappView

If you come from the world of Factory Talk or are familiar with B&R’s other visualization solution VC4 and are transitioning to mappView, then you’ll likely notice that Multistate Indicators or Text with an IndexDatapoint is not a standard widget in mappView. This does not mean the effect cannot be achieved and this guide will show the three ways I know to accomplish this.

Note: This guide assumes at least a basic understanding of mappView and the TextSystem

The String Method (Easiest):

  1. Bind a string variable to a TextOutput widget. In this example I created a task named MultiText and a variable named TextString.
    image
    image

  2. In the task with your string variable create the selector variable as some integer, I named mine MultiTextSelector.

  3. Then in code use your preferred method for selecting the desired string based on the selector variable. I used a MUX operation.

  4. If translations are not a factor in your use case then you could stop here. However simply having the desired text directly in the string means you use lose out on the benefits of the TextSystem, like translations.

  5. To reference the TextSystem through the string variable you need to use the following syntax: $$IAT/NameSpace/TextId.

  6. The NameSpace and TextId can be found here in the .tmx file.
    image

  7. Thus to redo the example from (3) would look as such:

The Snippet Method (Intended):
I say Intended because if you were to read through the Help this would likely be the solution you arrive at. While I won’t go over snippets in full there are three types of snippets you can use in mappView Numeric, String, and IndexText. As you might guess, we care about IndexText. For more info on snippets see here.

  1. To create a snippet you first need to pull in the snippet file. Under mappView->Resources select the Snippets folder and then from the toolbox pull in the Snippet file.

  2. In the snippet file create a new snippet with type IndexText. The format for this is:
    <Snippet id=“IndexTextSnippetOpcUa” xsi:type=“session” type=“IndexText” formatItem=“IAT/TextId.{1}” />

  3. The .{1} is a placeholder that gets bound later to the selector variable

  4. In the text file we now need to create the entries that this snippet will select from. The TextId now has a format of TextId.X where X is going to be the value of the selector variable. For example:
    image

  5. The last step is to create two bindings. One that binds the selector variable to the snippet and one that binds the snippet to TextOutput widget. Note: These bindings have to be made manually in the .binding file and the widget binding will not show up in its properties window.

The DropDown Method (My Preference):
The string method is certainly the easiest to setup but relies on PLC code and the user needs to be very careful with the syntax of the strings. The snippet method is fully client side but complex to setup and most notably the binding for selector to snippet is globally active. This means that bindings for texts not currently on screen are still eating up resources. The DropDown method is fully client side, minimally complex, and all bindings are content specific.

  1. Instead of a TextOutput widget we are going to use a DropDown widget and set its Enable property to false.
  2. This accomplishes two things for us. By disabling the widget if a user clicks on it the normal dropdown menu will not open and thus functions as a text output. We can now also use the “disabled” appearance properties to style the widgets the same as we would for a TextOutput widget.
    image
  • I’d also recommend creating a unique Style for these dropdowns. For a good guide on styles see: Status Indicators
  1. Next in the dataProvider Default property select the texts from the TextSystem that you want to index through.

  2. Lastly bind you selector variable to the selectedIndex property.
    image

7 Likes