Another option that works very well if you are/can use views is to have 
a lookup table with 2 cols. 1st col the fk to the main table, 2nd col 
the color value you want, then make the view to combine these.  Then in 
the grid,  .SetAll("DynamicBackColor", mylookuptablebackcolor)

Peter Cushing wrote:
> Jeff Johnson wrote:
>> Sytze:  Here is an example of a grid that is highlighted one of six
>> different colors based on vtank.cur_ostat.  This code is the .init of the
>> grid.  This takes care of everything with respect to highlighting and there
>> is no performance problem because of the nested IIF's.
>>
>>   
> <snip>
>>     .SetAll("DynamicBackColor", ;
>>        "IIF(RECNO(THIS.RecordSource) = THIS.ncurrentrecord," + ;
>>          "THIS.gridactivebackcolor," + ;
>>          "IIF(vtank.cur_ostat = 'S'," + ;
>>            "RGB(0,255,0)," + ;
>>            "IIF(vtank.cur_ostat = 'A'," + ;
>>              "RGB(0,200,0)," + ;
>>              "IIF(vtank.cur_ostat = 'D'," + ;
>>                "RGB(0,128,0)," + ;
>>                "IIF(vtank.cur_ostat ='W'," + ;
>>                  "RGB(255,0,0)," + ;
>>                  "IIF(vtank.cur_ostat = 'C'," + ;
>>                    "RGB(0,0,255)," + ;
>>                    "THIS.griddefaultbackcolor))))))", ;
>>        "COLUMN")
>>   
> Hi Jeff,
> I needed to do something similar with a grid and thought of doing this 
> but didn't like how messy it got.  I tried to use a form method but 
> could not get it to work.  Now I have a function in my procedure file 
> that returns a colour string based on certain conditions.  I use this 
> code in the init:
> thisform.pf.page3.grdmilestone.SetAll("DynamicBackColor", ;
>    "evaluate(getcolour())", "Column") 
> 
> Peter
> 
> 
> 
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to