Showing Value as Text
I have a tag (integer) that is 0 - 9; I want to show a text for the value itself. Such as, '0' as OFF, '1' as ON, '2' as FAULT, etc. Is there a formatting option for ValueBox like this?
3 replies
-
Hi sagar
Sorry it took so long to respond to this. This one must've fallen through the cracks.
You can you use the ValueTransform property of the ValueBox and use embedded "if" statements to accomplish this. For example,
if(value==0,'OFF', if(value==1,'ON',...))
-
Hi, Steve Mason . Thanks for the response. However, it is not working. I am using:
if(value==0,'OFF', if(value==451,'ON'))
I get the error below:
04/06/2023 10:45:13 AMValueTransform failed. Control: ValueBox1, ValueTransform: 'if(value==0,'OFF', if(value==451,'ON'))', TVQ: TVQ: StartTime: 04/06/2023 10:18:12.289, EndTime: 04/06/2023 10:18:12.2890001, Value: 451, Quality: 0xC0if() takes exactly 3 arguments at NCalc.Domain.EvaluationVisitor.Visit(Function function) at NCalc.Domain.EvaluationVisitor.Evaluate(LogicalExpression expression) at NCalc.Domain.EvaluationVisitor.Visit(Function function) at NCalc.Expression.Evaluate() at AxiomCore2.ControlProperties.Value.ExecuteValueTransform(TVQ tvq)