Also, another option may be you can use the ICASE function for multiple cases in your SetAll if you're using VFP9.
Fred On Wed, Sep 22, 2010 at 9:48 AM, Tina Currie <[email protected]> wrote: > Hi all, > > > > I'm displaying a grid of some stuff the user wants to see from a search > screen. They put in the criteria and it selects to a cursor. Based on a > status field in the data, I want to colour code each line in the grid so > they can easily see which jobs are at which status. > > > > I've done this before when I was checking only one field and changed it > based on whether that field was true or false. Code worked a treat and > looked like this: > > > > thisform.Grid1.SetAll("DynamicBackColor","IIF(offhired=.t.,RGB(2,136,200),RG > B(255,255,255))", "Column") > > thisform.Grid1.SetAll("DynamicForeColor","IIF(offhired=.t.,RGB(255,255,255), > RGB(0,0,0))", "Column") > > > > Now the field I want query has 3 possible status codes and I want a > different colour row for each one. I've tried the following with no joy: > > > > SELECT CurSearchResults && the cursor I selected into > > SCAN > > DO CASE > > CASE SearchByClient.status = '00' && To Be Allocated > > > thisform.Grid1.SetAll("DynamicBackColor","iif(CurSearchResults.status = > '00',RGB(2,136,200),RGB(255,255,255)", "Column") > > > thisform.Grid1.SetAll("DynamicForeColor","iif(CurSearchResults.status = > '00',RGB(255,255,255),RGB(0,0,0)", "Column") > > > > CASE SearchByClient.status = '10' && Allocated > > > thisform.Grid1.SetAll("DynamicBackColor","iif(CurSearchResults.status = > '10',RGB(128,255,0),RGB(255,255,255)", "Column") > > > thisform.Grid1.SetAll("DynamicForeColor","iif(CurSearchResults.status = > '10',RGB(255,255,255),RGB(0,0,0)", "Column") > > > > CASE SearchByClient.status = '20' && To Be Invoiced > > > thisform.Grid1.SetAll("DynamicBackColor","iif(CurSearchResults.status = > '20',RGB(145,0,72),RGB(255,255,255)", "Column") > > > thisform.Grid1.SetAll("DynamicForeColor","iif(CurSearchResults.status = > '20',RGB(255,255,255),RGB(0,0,0)", "Column") > > ENDCASE > > ENDSCAN > > > > This code makes all lines in the grid blue, regardless of status. Is it > because I'm using SetAll? What am I missing and is what I want to do even > possible? > > It's 2:45am here in Australia and this one kept me awake so I thought I'd > get up and deal with it.... > > > > TIA, > > > > Tina > > > > --- StripMime Report -- processed MIME parts --- > multipart/alternative > text/plain (text body -- kept) > text/html > --- > [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 Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** 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.

