[SOLVED] Text field component

Hello, I want to change the value of a tag to display in a label , how can I do that ?
Like set or update for another word :

Connected = ready

I’m… confused. Can you try to be clearer/more specific ?

In Vision, the best way to do this is probably via the style customizer. Add a custom property to the label. Bind it to the tag in question. Give the component styles, driven by this custom property, which can include changing the text.


1 Like

But is an string

Please explain what the input values are and what you want to display in each case. Draw a table using the </> code formatting button like this:

Tag     | Label text
'Go'    | 'Running'
'NoGo'  | 'Stopped'
'eStop' | 'Emergency stop pressed'
 etc.   |  ...

the string that the tag return is Connected, I need it to display “New alarm” in the label, that is all

There has to be at least two states! Otherwise what is the point of having the tag?

Anyway, I think you are looking for an Expresson Binding.

Fault is the second state as something wrong happen

Why didn’t you draw the table as requested? What is to be displayed when “Fault” is received? Can you see how difficult it is to help you?

Tag            | Label text
'Connected'    | 'New value'
'Fault'        | 'Something wrong'

And if I want to change the background color depending if :

Tag            | Label text
'Connected'    | 'New value' GREEN
'Fault'        | 'Something wrong'  RED

For some, perhaps. Maybe you should get better at mind reading? Jeez :face_exhaling:

Either use the same expression on the background fill and substitute “New value” and “Something wrong” for colours like color(0,255,0) and color(255,0,0), or you could go back to @PGriffith 's answer and use a style customiser

Define the problem first:

Tag            | Label text       | Label color
'Connected'    | 'New value'      | GREEN
'Fault'        | 'Something wrong'| RED

Now it should be clear that you will require a second binding.

1 Like

thanks, that worked!