# Calendar cell background color/icon binding

**URL:** <https://forum.inductiveautomation.com/t/calendar-cell-background-color-icon-binding/4618>\
**Category:** Ignition\
**Created:** [June 13, 2012, 12:03am UTC](https://forum.inductiveautomation.com/t/calendar-cell-background-color-icon-binding/4618 "2012-06-13T00:03:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexW](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@AlexW](https://forum.inductiveautomation.com/u/AlexW)\
**Post date:** [June 13, 2012, 12:03am UTC](https://forum.inductiveautomation.com/t/calendar-cell-background-color-icon-binding/4618/1 "2012-06-13T00:03:00Z")

</div>

I ment to make this post [http://www.inductiveautomation.com/forum/viewtopic.php?f=70&t=8297](http://www.inductiveautomation.com/forum/viewtopic.php?f=70&t=8297) into a feature request but it was locked before I could do so.

i’M looking for a way of binding the cell background colors on the calendar control to the date represented by that cell. I imagine this might be useful for others using the calendar control i.e. downtime tracking, coloring by daily production values, historical alarm/event viewing.

Cheers

Alex

---

<div class="post-metadata">

**Author:** ![AlexW](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@AlexW](https://forum.inductiveautomation.com/u/AlexW)\
**Post date:** [June 13, 2012, 5:20am UTC](https://forum.inductiveautomation.com/t/calendar-cell-background-color-icon-binding/4618/2 "2012-06-13T05:20:52Z")

</div>

was able to get a version of this to work using the month view component

steps:

1. set the month views Event display mode to ‘highlight’
2. you will need to drive the events table with your own query, my working one is as follows

`SELECT [date] as startDate, [date] as endDate, 'blue' as color, 1 as description
FROM mytable
WHERE [date]>'{Root Container.Month View.monthStartDate}' AND
[date]<='{Root Container.Month View.monthEndDate}'`  
where monthStartDate and monthEndDate are dynamic (are we calling the custom now?) properties driven as follows  
Month End

`dateArithmetic(dateArithmetic(todate({Root Container.Month View.selectedDay}),-dateextract(todate({Root Container.Month View.selectedDay}),"day"
)+1,"day"),1,"month")`  
Month Start

`dateArithmetic(todate({Root Container.Month View.selectedDay}),-dateextract(todate({Root Container.Month View.selectedDay}),"day"
)+1,"day")`

I’ve attached an example picture of what this looks like.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/cafa7544ba6fa0f77b4930dc66fcc8a2b4f77ddf.JPG)

---

<div class="post-metadata">

**Author:** ![gnguyen](https://avatars.discourse-cdn.com/v4/letter/g/41988e/32.png) [@gnguyen](https://forum.inductiveautomation.com/u/gnguyen)\
**Post date:** [June 28, 2012, 9:42am UTC](https://forum.inductiveautomation.com/t/calendar-cell-background-color-icon-binding/4618/3 "2012-06-28T09:42:46Z")

</div>

hi AlexW,

Nice find. I tried this way but I can’t change the color ; tried to change it to red or even a wrong color with no effect. Have you a way to go ? can you upload your windows ?  
With what version of Ignition did you tried it ? I’m using 7.5…

TIA

---

<div class="post-metadata">

**Author:** ![AlexW](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@AlexW](https://forum.inductiveautomation.com/u/AlexW)\
**Post date:** [July 12, 2012, 1:11am UTC](https://forum.inductiveautomation.com/t/calendar-cell-background-color-icon-binding/4618/4 "2012-07-12T01:11:51Z")

</div>

Sorry my query can be a bit misleading. The color in the query is really just a placeholder. I don’t know what the component actually requires in terms of fields but I figured I may as well provide a table with the same number of columns and column names as what it expects.

`SELECT [date] as startDate, [date] as endDate, 'blue' as color, 1 as description
FROM mytable
WHERE [date]>'{Root Container.Month View.monthStartDate}' AND
[date]<='{Root Container.Month View.monthEndDate}'`

should really be

`SELECT [date] as startDate, [date] as endDate, 'blah' as color, 'blah' as description
FROM mytable
WHERE [date]>'{Root Container.Month View.monthStartDate}' AND
[date]<='{Root Container.Month View.monthEndDate}'`

The cell color is set by choosing the color for the “event highlight background” property

remember to set the month views event display mode to highlight
