General Discussions
Write an Expression

I want to write an expression on "digital status" tag. According to changing in value of digital status tag, different text should be shown.
As like, If digital status tag value is 0 then it should shows 'disabled', If its value is 1 then it shows 'running', if tag value is 2 then it shows 'blocked', if the value is 3 then it shows 'unknown'.

I want to write an expresion in tags. How can i write expression for that?
Can you please provide me one short example to do that so!

Thanks in advance.

I want to write an expression on "digital status" tag. According to changing in value of digital status tag, different text should be shown. As like, If digital status tag value is 0 then it should shows 'disabled', If its value is 1 then it shows 'running', if tag value is 2 then it shows 'blocked', if the value is 3 then it shows 'unknown'. I want to write an expresion in tags. How can i write expression for that? Can you please provide me one short example to do that so! Thanks in advance.

I think that there are two approaches you could take:

  1. In the Idea Studio, use the multi-text widget to display the text you want based on the value of the digital status tag. For more info, drag the multi-text widget onto screen and press F1.
  2. If you want the appropriate text as a tag then create a calculation tag with an expression that returns certain text based on the value of the digital status:
..\digitaltagsim\value == 1 ? "One" :
..\digitaltagsim\value == 2 ? "Two" :
..\digitaltagsim\value  == 3 ? "Three" : "Unknown"

Hope this helps....

I think that there are two approaches you could take: 1. In the Idea Studio, use the multi-text widget to display the text you want based on the value of the digital status tag. For more info, drag the multi-text widget onto screen and press F1. 2. If you want the appropriate text as a tag then create a calculation tag with an expression that returns certain text based on the value of the digital status: ```` ..\digitaltagsim\value == 1 ? "One" : ..\digitaltagsim\value == 2 ? "Two" : ..\digitaltagsim\value == 3 ? "Three" : "Unknown" ```` Hope this helps....

You can actually just set the On Text and Off Text parameters.

You can actually just set the On Text and Off Text parameters.

That only works for an either / or. In certain cases you may have an integer value in which each value from say 0 - 31 has a meaning that you want displayed as text. The Multi-text widget or the calculation tag can be used in these types of situations.

That only works for an either / or. In certain cases you may have an integer value in which each value from say 0 - 31 has a meaning that you want displayed as text. The Multi-text widget or the calculation tag can be used in these types of situations.

Haha, missed the three.

You can use the Equipment Type paramater on the IO tag and a Style Settings tag to solve this without expressions now.

Haha, missed the three. You can use the Equipment Type paramater on the IO tag and a Style Settings tag to solve this without expressions now.
edited Jan 21 '20 at 5:48 pm

Wow - I was not aware of this feature! Thanks for pointing it out Mike!

Wow - I was not aware of this feature! Thanks for pointing it out Mike!

Thanks, Mike! The Equipment Type is new to Version 12 smile

Thanks, Mike! The Equipment Type is new to Version 12 :)

Trihedral Engineering Ltd.

112
6
4
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft