Adding Color to the Background using scripting

Hello,

I wanted to change the background color based on the SQL Database I have.

So there’s a table on which when SQL Query is applied returns an integer. However, I wanted a color to be changed based on that integer value.

I am new to Ignition, so don’t have much idea regarding this thing. Also, if it can be done using python script, please suggest that as well.

Are you doing this in Vision or Perspective?

I’m doing in vision.

Use a client query tag, and bind your window(s) background color property to it.

Thanks for the suggestion. However, I had a doubt regarding it, my output of the SQL Query will be a dataset, and when created the tag, under the Value section, I can see all the columns I am using. So, how can we bind the color to a column row having values either 0 or something else?

For example, I have a table in which a column is named order_date. If the date is there that means it is True, however, if the order_date is NULL, the background color needs to blink yellow and orange. Now, after I created the client tag as suggested by you, I tried binding the background color with the [client]Value[order_date] and got an error saying BadTagPath because of illegal character [.

Could you suggest a way to resolve it?

Use the lookup() expression function - given a dataset, you can check for a certain value, and include a ‘no match’ value.