>I want to allow users to highlight rows in a grid if a particular field
>value exists. This is not a problem if i am allowing just ONE highlighting
>option. For example, in the SETALL code below, i let the user highlight
>rows if the balance is greater than zero using an IIF:
>thisform.pgfpagerefresh1.page1.grdnav.setall("DynamicBackColor", ;
> "IIF(v_accounts.balance > 0, ;
> rgb(255,128,128),rgb(255,255,255))", ;
> "COLUMN")
>But if i want to allow the user to highlight different sets of rows
>("Balance exists" OR "ordered more than 30 days ago", OR "orders from
>canada"), i need to leave any RGB setting as it was and not set it to white
>as shown in the IIF example above, RGB(255,255,255). I really need a case
>statement of sorts:
>CASE balance > 0
> RGB(n,n,n)
>CASE orderdate < DATE()-30
> RGB(n,n,n)
>CASE ordcountry = "CANADA"
> RGB(n,n,n)
>OTHERWISE
> RGB(n,n,n)
>How do i implement something like this using a SETALL (or perhaps not using
>a SETALL) so that all three highlights can be in use at once?
I wrote a couple of procedures that might help.
********** Start of Included Code **********
* ion
* Interactive On
* Last Modification: 99-05-04
*
* The parameters are interpreted follows:
* 1) If no parameters, return .null..
* 2) Consider the value of parm01 against the succeeding pairs (2&3,
* 4&5, etc.) If the value of parm01 = the first of the pair,
return
* the second of the pair.
* 3) None of the pairs hit: if there is a parameter left over,
return it
* else return .null..
procedure ion
lparameters parm1, parm2, parm3, parm4, parm5,;
parm6, parm7, parm8, parm9, parm10,;
parm11, parm12, parm13, parm14, parm15,;
parm16, parm17, parm18, parm19, parm20,;
parm21, parm22, parm23, parm24, parm25,;
parm26, parm27
local parmcount
parmcount=pcount()
if parmcount=0
return .null.
endif
local parmptr, parmptrstr
for parmptr=2 to parmcount-1 step 2
parmptrstr=alltrim(str(parmptr))
if (parm&parmptrstr)=parm1
parmptrstr=alltrim(str(parmptr+1))
return parm&parmptrstr
endif
endfor
if parmcount%2=0
parmptrstr=alltrim(str(parmcount))
return parm&parmptrstr
else
return .null.
endif
endproc
* icase
* Interactive Case
* Last Modification: 98-12-17
*
* The parameters are interpreted follows:
* 1) If no parameters, return .null..
* 2) Consider each pair (1&2, 3&4, etc.). If the first of the pair
is .t.,
* return the second of the pair.
* 3) None of the pairs hit: if there is a parameter left over,
return it
* else return .null..
procedure icase
lparameters parm1, parm2, parm3, parm4, parm5,;
parm6, parm7, parm8, parm9, parm10,;
parm11, parm12, parm13, parm14, parm15,;
parm16, parm17, parm18, parm19, parm20,;
parm21, parm22, parm23, parm24, parm25,;
parm26, parm27
local parmcount
parmcount=pcount()
if parmcount==0
return .null.
endif
local parmptr, parmptrstr
for parmptr=1 to parmcount-1 step 2
parmptrstr=alltrim(str(parmptr))
if parm&parmptrstr
parmptrstr=alltrim(str(parmptr+1))
return parm&parmptrstr
endif
endfor
if parmcount%2==0
return .null.
else
parmptrstr=alltrim(str(parmcount))
return parm&parmptrstr
endif
endproc
********** End of Included Code **********
Sincerely,
Gene Wirchenko
Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.