How to use a textoutput as a text list

Hi all,

For whatever reason, Mappview lacks an easy way to show my machine state dynamically by the use of a text list. Simplified, when my case step changes, the number is used to trigger a text in a textoutput field. When the case changes to another number again, another text is shown in the same text output. I could do this by writing a different string value to a string variable every time, but then its not translatable, so I need a localizable text list

When I’m binding a text output, it shows me a tab called “List” where I am able to bind a OPC-UA selector and a binding list. This seems to be the way I need, but I can’t get it to work. When I ask B&R they use another method using snippets, but that’s another dead end as well, simply because I lack the xml knowledge and the way things communicate.

Would someone be willing to explain to me in detail how to accomplish this?
I have a localized text file with my states in it and I use an integer (or actually Enum) which should trigger these texts into an text output.

In the images I hope you can find what I am trying to accomplish with these binding lists. (Sorry, new user can only put 1 image).

Thanks in advance!

Hi Patrick,
this way I think you can also achieve the goal. I guess the reason why it is not working now is that $IAT/… is not a valid element here.
You can try creating two (just to try it) session variables to store the full identifiers of the text.

Here is how it could look like:
create a list having these elements

<List xsi:type="session" id="List1" attribute="value">
  <bt:Element index="0" refId="state0" />
  <bt:Element index="1" refId="state1" />
  <bt:Default refId="state_undefined" />
</List>

and session variable file with these variables:

<?xml version="1.0" encoding="utf-8"?>
<VariablesSet id="setID" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://www.br-automation.com/iat2015/session/engineering/v1">
  <Variables>
    <Variable name="state0" xsi:type="ANY_STRING" value="$IAT/Unit_StateID/Off" />
    <Variable name="state1" xsi:type="ANY_STRING" value="$IAT/Unit_StateID/Positioning" />
    <Variable name="state_undefined" xsi:type="ANY_STRING" value="Not yet defined" />
  </Variables>
</VariablesSet>

With this approach you can get also some default text for the case you will add more states in future without breaking the text system at the widget.
Other option would be to use the snippet (but you already know).

I hope I do not have a typo there. I did not compile it. Let me know if that approach is working for you.

Tom

3 Likes

Tomas - Two words - Absolutely perfect!

Thank you very much, that was exactly what I was looking for, session variables.
Fixed it and learned something new today! Thanks again

2 Likes

There may be a second solution:
You can use the Widget DropDownBox and configure it in a way that it visually does not appear as drop down box. Set enable=false and showOpenIndicator=false, this should prevent the list from opening when you click on it and hide the arrow.
Change the colors that it doesn’t appear greayed out and maybe you have to change some mousedown colors, that the users does not notice it’s clickable.
The propertie dataProvider is bindable to IAT Texts with an assigned value.
selectedValue is bindable to your step number. That way the Text of the widget should change if the step number changes.
Essentially you are switching the selected Item from the DropDownBox with the step number but nobody notices that it’s a DropDownBox :wink:

Pro of this solution: The binding is directly editable in the MappView editor and everybody understands it.
Con: The widget is beeing “abused”.

2 Likes

Björn, thank you! That is a very good alternative. Saving this for later! It is actually much easier that way.

Funnily enough, the first method I was thought was by a colleague of mine, it was a somewhat butchered way to make it happen.

Insert an imagelist and make it invisible, use it’s selectedIndex for binding with your integer, and then trigger an event that if this selectedindex changes to a specfic number it will show my text id entry to TextOutput1.

There are more ways that lead to Rome but I prefer Tomas and yours!

Best Regards
Patrick

2 Likes

You can also use textsnippeds for them.

If you want i can show a example for.

Raimund, yes please! That way I will know all the various options. Thanks!

Hello,

io just looked around and at least there is a sample inside here.

have a look at:

Hi Raimund,

Thank you for showing me this topic. In my next project I will definitely use the snippet method because I believe that’s the intended use method.

However, the MUX version is also very interesting, all great ways to do this. Thanks again!