# Adding Color to the Background using scripting

**URL:** <https://forum.inductiveautomation.com/t/adding-color-to-the-background-using-scripting/37707>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [August 14, 2020, 4:39am UTC](https://forum.inductiveautomation.com/t/adding-color-to-the-background-using-scripting/37707 "2020-08-14T04:39:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pajmera](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@pajmera](https://forum.inductiveautomation.com/u/pajmera)\
**Post date:** [August 14, 2020, 4:39am UTC](https://forum.inductiveautomation.com/t/adding-color-to-the-background-using-scripting/37707/1 "2020-08-14T04:39:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 14, 2020, 5:39am UTC](https://forum.inductiveautomation.com/t/adding-color-to-the-background-using-scripting/37707/2 "2020-08-14T05:39:32Z")

</div>

Are you doing this in Vision or Perspective?

---

<div class="post-metadata">

**Author:** ![pajmera](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@pajmera](https://forum.inductiveautomation.com/u/pajmera)\
**Post date:** [August 14, 2020, 5:51am UTC](https://forum.inductiveautomation.com/t/adding-color-to-the-background-using-scripting/37707/3 "2020-08-14T05:51:32Z")

</div>

I’m doing in vision.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 14, 2020, 2:59pm UTC](https://forum.inductiveautomation.com/t/adding-color-to-the-background-using-scripting/37707/4 "2020-08-14T14:59:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pajmera](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@pajmera](https://forum.inductiveautomation.com/u/pajmera)\
**Post date:** [August 14, 2020, 6:23pm UTC](https://forum.inductiveautomation.com/t/adding-color-to-the-background-using-scripting/37707/5 "2020-08-14T18:23:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 14, 2020, 7:09pm UTC](https://forum.inductiveautomation.com/t/adding-color-to-the-background-using-scripting/37707/6 "2020-08-14T19:09:44Z")

</div>

Use the [`lookup()`](https://docs.inductiveautomation.com/display/DOC80/lookup) expression function - given a dataset, you can check for a certain value, and include a ‘no match’ value.
