Page 1 of 1

Associating an AnalogNumeric Object with Text Library

Posted: Thu Aug 06, 2015 5:09 am
by BURAKUSLU
Hi there,
Is it possible to associate an AnalogNumeric object with text library? In my project, there is an AnalogNumeric object which displays actual temperature of the enviroment. If there is a sensor failure, it displays 31000 which does not make sense for the end user. Can this AnalogNumeric object display a text if its value is 31.000? If yes, does this text have to be in the text library?

Regards,
Burak

Re: Associating an AnalogNumeric Object with Text Library

Posted: Fri Aug 28, 2015 11:41 am
by AMitchneck
You can set the AnalogNumeric to display string and add an expression like the following:

Code: Select all

( ((float)value) == 31000.0f ? "Error" : ((float)value).ToString("0.00"))
This expression displays the tag value with two decimal points if it is not equal to 31000, otherwise it displays Error. (For more information, see C# custom number formatting https://msdn.microsoft.com/en-us/librar ... 10%29.aspx.)

Re: Associating an AnalogNumeric Object with Text Library

Posted: Thu Sep 03, 2015 3:43 pm
by Transistor
Or, if you have an alarm bit in the PLC, then set the visibility of the AnalogNumeric object to turn off with the alarm bit and show a text object instead.