FUNCTION MapColor LPARAMETERS lpnDay *lpnDay is the day of the month as return by DAY(DATE()) DO CASE CASE m.lpnDay = 1 RETURN RGB(255,255,255) CASE m.lpnDay = 2 RETURN RGB(128,255,255) CASE m.lpnDay = 3 RETURN RGB(255,0,0) CASE m.lpnDay = 4 RETURN RGB(255,255,128) CASE m.lpnDay = 5 RETURN RGB(0,0,255) CASE m.lpnDay = 6 RETURN RGB(0,255,0) CASE m.lpnDay = 7 RETURN RGB(255,0,255) CASE m.lpnDay = 8 RETURN RGB(0,255,255) CASE m.lpnDay = 9 RETURN RGB(255,255,0) *.... and so on CASE m.lpnDay = 31 RETURN RGB(255,255,0) OTHERWISE ENDCASE ENDFUNC && MapColorOnce you have this method, you can use it to change your grid's DynamicBackColor as like this:
*1. If defined in a prg set procedure to myprg.prg this.mygrid.column1.DynamicBackColor = "MapColor(DAY(mydatefield))" *2. If defined in the form where your grid is contained this.mygrid.column1.DynamicBackColor = "thisform.MapColor(DAY(mydatefield))"
do case case lnMonth=1 do case case lnDay=1 return rgb(255,255,255) * and so on endcase * and so on endcaseThe advantage of mapping color like this is that you are in control of the selection of the colors and you can provide the users a legend of the colors used that represent the days of the month.
"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."
- Ephesians 4:29-30 NIV
Dare to Question -- Care to Answer
Time is like water in a sponge, as long as you are willing you can always squeeze some.
--Lu Xun, Father of Modern Chinese Literature