FactoryTalk View expression help

ksmohammed

Member
Join Date
Jan 2018
Location
Dallas
Posts
6
I am using multi state color animation. My current expression is this.

if ({#3\SEVERITYY} >= 750 ) then 2
else if ({#3\SEVERITYY} >= 500 AND (750<= {#3\SEVERITYY})) then 3
else if ({#3\SEVERITYY} >= 250 AND (500<= {#3\SEVERITYY})) then 4
else 8

SEVERITYY is an Analog tag. When i set my tag value to 750 and above i get my color at state 2.

When i set my tag value between 500 and 750 i get my state 3 color.
But when i set the tag value between 250 and 500 i still get state 3 color.

Anyone had this problem before?
 
put the parentheses around the first condition.

if ({#3\SEVERITYY} >= 750 ) then 2
else if (({#3\SEVERITYY} >= 500) AND (750<= {#3\SEVERITYY})) then 3
else if (({#3\SEVERITYY} >= 250) AND (500<= {#3\SEVERITYY})) then 4
else 8
 
put the parentheses around the first condition.

if ({#3\SEVERITYY} >= 750 ) then 2
else if (({#3\SEVERITYY} >= 500) AND (750<= {#3\SEVERITYY})) then 3
else if (({#3\SEVERITYY} >= 250) AND (500<= {#3\SEVERITYY})) then 4
else 8

Thank you for the reply, I followed your suggestions and this is what i get.

Value of 750 and above i get state 2, Between 500 and 750 i get state 4, and between 0 to 500 i get state 8.

This is really strange.
 
Factory Talk is Infuriating

first: Double-check the "value" for each state. in the general area of the states tab.
make sure that the values 2,3,4 and 8 match the states you intend to display.
make sure the colors and other items are correct for each state.

next: you don't need to test for a condition you already know is true, get rid of the second condition in the else ifs.

something like:

if ({#3\SEVERITYY} >= 750 ) then 2
else if ({#3\SEVERITYY} >= 500) then 3
else if ({#3\SEVERITYY} >= 250) then 4
else 8

should work

try that and let us know.
 
isnt your condition wrong?

Code:
if ({#3\SEVERITYY} >= 750 ) then 2
else if ({#3\SEVERITYY} >= 500 AND (750[COLOR="Red"] <=[/COLOR] {#3\SEVERITYY})) then 3
else if ({#3\SEVERITYY} >= 250 AND (500[COLOR="Red"] <=[/COLOR] {#3\SEVERITYY})) then 4
else 8

shouldnt it be
Code:
if ({#3\SEVERITYY} >= 750 ) then 2
else if (({#3\SEVERITYY} >= 500) AND (750[COLOR="Red"] =>[/COLOR] {#3\SEVERITYY})) then 3
else if (({#3\SEVERITYY} >= 250) AND (500[COLOR="Red"] =>[/COLOR] {#3\SEVERITYY})) then 4
else 8

For the implentation i would do it like GhostPepper said.
Its much easyer to read (and to not make mistakes).
 
Last edited:
Agree with Crawler. Also, I would say that it isn't great practice to include the equal to on both edges of a case (So if the first case is >=750, then the next one should be <750). In this case, the priority would get sorted out by the fact that you are using elseif but it's a bit less clear.
 

Similar Topics

This issue happens occasionally but is getting annoying...I cant click what I said in the title randomly. Sometimes it works sometimes it doesnt...
Replies
1
Views
1,598
Hello, I am fairly new to AB PLC and HMI. I am using Factorytalk View to create an HMI application. While using Macros, I wanted to create a...
Replies
3
Views
2,414
Using PV6+, FactoryTalk View Studio to talk with PLC The expression error that keeps popping up are tag/10 or tag/100 (which doesn't make sense)...
Replies
3
Views
2,917
I have apparently hit about a 980 character limit in the FT View ME String expression editor. I need to fit about 1 more line if I could. Is...
Replies
2
Views
2,831
Good Morning , I have a delicate SLC 5/05 system that I would rather not make any changes to the PLC. I have a Panelview Plus and I would...
Replies
7
Views
4,220
Back
Top Bottom