Skip to main content
May 3, 2023 11:55 AM UTC
Question

Traffic Light Attribute Implementation

Hello everybody,

 

I have a very short question about generating a new attribute including a traffic light. I have created a new integer attribute with the following formula behind:

 

 

 

(state.state == “CANCELLED”) ? 0 : (state.state == “INWORK”) ? 1 : (state.state == “RELEASED”) ? 2 : 3

 

 

 

But when I try to save the changes I get the following warning: "Value entered for Formula is invalid."

 

What am I doing wrong here?

 

Many thanks!

 

 

 

 

 

 

8 replies

May 3, 2023 8:39 PM UTC
((state.state == “CANCELLED”) ? 0 : ((state.state == “INWORK”) ? 1 : ((state.state == “RELEASED”) ? 2 : 3 )))
May 4, 2023 6:35 AM UTC

Still not working ...

May 4, 2023 8:24 AM UTC

I guess the == operator can't compare two strings then.

Perhaps try a Business Algorithm to compare them.

Jul 10, 2025 8:00 AM UTC

Hi, I know it's been a while since you opened this thread, but I had the exact same issue, and I have recently discovered what the problem was!

 

If you want to create a "traffic ligh" attribute the normal thing is to go to the WIndchill Help, and copy the example code:

avillena_0-1752134098077.png

 

The problem is that the quotation marks of this example code are the reason why you get the message "Value entered in Formula is invalid", although the code is correct!!

I have realised that the quotation marks copied from Windchill Help are different from the quotation marks that you type, and this is the reason of the error!

avillena_1-1752134363302.png

So just change the quotation marks and the value entered in the formula will work!!!