>I am pulling data into a cursor and an associated value for each field that indicates the value's status, for example
>
>SELECT name, address, zip FROM myTable
>
>and for each field, I have an associated "Current" status (T or F) which is generated in the selection routine.
>
>What I want to do is display a grid showing the cursor and change the background color depending on the associated "Current" value.
>
>I was thinking of doing something along the line of...
>
>DEFINE CLASS RecordSet as Collection
>
>*FOR EACH FIELD IN THE CURSOR
>FOR i= 1 to FCOUNT()
>STORE FIELD(I) TO fldname
>
>*ADD THE VALUE AND STATUS TO THE RECORDSET COLLECTION
>THIS.AddObject(fldname,'RecordValues')
>
>*UPDATE THE VALUES
>THIS.&FLDNAME..VALUE = eval('Cursor.'+fldname)
>THIS.&FLDNAME..CURRENT = GetFieldStatus()
>ENDFOR
>ENDDEFINE
>
>DEFINE CLASS RecordValues as Custom
>Value=""
>Current=.F.
>ENDDEFINE
>
>Then define a grid using the recordset and showing a background color based on the Current property.
>
>What I don't want to do, is to have to requery for the status once I get the data as it would take an inordinate amount of time for large recordsets.
>
>Any ideas or comments would be most appreciated.
>
>TIA,
>Larry Long
Larry,
Why do you need such a thing. Apart from taking considerable time creating many objects is unnecessary IMHO. You might simply add a bitmask field for those 3 fields and set it.
ie:
Name Address Zip
---- ------- ---
0 0 0 = 0
1 0 0 = 4
0 1 0 = 2
It's a simple bitset,bittest operation. Another approach for 254(or 5) fields might be adding a single string with T/F's in it representing states.
Cetin