Skip to main content
6-Contributor
May 3, 2023
Question

Traffic Light Attribute Implementation

  • May 3, 2023
  • 2 replies
  • 2344 views

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!

 

 

 

 

 

 

2 replies

16-Pearl
May 3, 2023
((state.state == “CANCELLED”) ? 0 : ((state.state == “INWORK”) ? 1 : ((state.state == “RELEASED”) ? 2 : 3 )))
6-Contributor
May 4, 2023

Still not working ...

16-Pearl
May 4, 2023

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

Perhaps try a Business Algorithm to compare them.

14-Alexandrite
July 10, 2025

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!!!