FactoryTalk Expressions

mcswc3

Member
Join Date
Feb 2012
Location
USA
Posts
24
I'm new to FactoryTalk and am struggling finding any information on using expressions.

1. How are you suppose to learn expressions - both correct syntax and know all what's possible to do?

2. Specifically:

I added:

IF {[PLC_1]Test_Tag_1} == 1
THEN 3
ELSE {[PLC_1]Test_Tag_2}

to the Multistate Button Indicator expression. State 3 on the button is the same button but "grayed-out" so the user sees the value but it's dull and the PLC won't do anything. And, it works! But, since I have to add this to a bunch of buttons, I was wondering if I could do something like:

IF {[PLC_1]Grayed_Out_Tag_1} == 1
THEN 3
ELSE DEFAULT

and "DEFAULT" would just use the tag that's already in the Value field...

Any suggestions would be much appreciated!
 
I'm new to FactoryTalk and am struggling finding any information on using expressions.

1. How are you suppose to learn expressions - both correct syntax and know all what's possible to do?

2. Specifically:

I added:

IF {[PLC_1]Test_Tag_1} == 1
THEN 3
ELSE {[PLC_1]Test_Tag_2}

to the Multistate Button Indicator expression. State 3 on the button is the same button but "grayed-out" so the user sees the value but it's dull and the PLC won't do anything. And, it works! But, since I have to add this to a bunch of buttons, I was wondering if I could do something like:

IF {[PLC_1]Grayed_Out_Tag_1} == 1
THEN 3
ELSE DEFAULT

and "DEFAULT" would just use the tag that's already in the Value field...

Any suggestions would be much appreciated!

Hi and welcome to the forum!

Try
this manual, chapter 23 specifically, it will tell you all you need to know about using expressions. Also, there is a syntax checker in the expression field, which will tell you if your syntax is "correct". Actually, all it can tell you is if your syntax is executable, but not necessarily if it will do what you want it to!

In answer to your question, I don't believe you can do what you're asking inside the expression for the value of the multi-state. The software does not recognize "DEFAULT".
You could perhaps do something like this:

Code:
IF {[PLC]Test_Tag} == 1 THEN 3
ELSE {[PLC]Default_Tag}
Then have the PLC continually write the value of the tag in the indicator into "Default_Tag".

Cheers,
Dustin

🍻
 
Thanks for the manual -- I'll check that out.

Any way to maybe use the Error state of the button?

IF {[PLC]Test_Tag} == 1 THEN ERROR
ELSE {[PLC]Default_Tag}
 
Starts in state 0, push the button once = output is fired (state 1), push the button twice = nothing happens (state 2), push the button a third time = back to state 0.

So maybe instead of using the error state, I should have asked if there is a way for the button to ignore state 2 when it's not grayed-out.

IF {[PLC_1]Test_Tag_1} == 1 THEN 2
ELSE {[PLC_1]Test_Tag_2} == 0 OR 1

is allowed, but does not restrict {[PLC_1]Test_Tag_2} to a 0 or 1 state...
 
Ended up making the Error state of the button a grayed-out version of the actual button and used the expression below. Works great. Thanks for your help!

IF {[PLC]System_In_Auto} == 1
THEN {[PLC]NOT_AN_ACTUAL_TAG_SO_TRIGGERS_ERROR_STATE}
ELSE {[PLC]Manual_Function}
 

Similar Topics

I have a button on my HMI that I only want visible under two conditions. One of them is a numerical value and the other is if a bit is on...
Replies
5
Views
9,847
I'm trying to get a multistate indicator to change color based on the value of a string variable that's read from an OPC server. The string value...
Replies
4
Views
10,636
I'm new to FactoryTalk and have gotten stuck on an expression. Here was my expression for OR the inputs together. {[PLC]Electrode_1_Bottom_LS} OR...
Replies
3
Views
1,956
I am trying to write an expression that will pull the value of a tag out of an array based on another tag. I can not find any documentation on how...
Replies
3
Views
2,820
Has anyone found information on using the variable message file? I keep looking for documentation on how to implement the message file name as a...
Replies
0
Views
33
Back
Top Bottom