Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Displaying Updated Grid Contents
Message
 
To
10/07/2001 18:40:45
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00528954
Message ID:
00529010
Views:
14
>I have a medical system a which records patient events.
>
>In the SQL below I display the cursor BOE contents in a grid which works fine.
>This displays patient events in date order.
>
>I want the user to be able to sort records in a different order, i.e. by event type rather than event date. I have tried putting the code below in the HEADER click code with "order by events.etype", but as soon as you click on the grid header the displayed grid blanks out.
>
>So basically the question is: once you have displayed the contents of a cursor on a grid, can you re-sort or re-query again, thus updating the cursor, and display the updated cursor on the same grid?
>
>Code used is:
>
>select events.mno, events.bkno, events.date, events.estatus, estatus.name as status, events.etype, etype.name as type, events.evloc, evloc.name as loc, events.keyw, keyw.name as staff ;
> from tcdata!events ;
> join tcdata!etype ;
> on etype.etype=events.etype ;
> join tcdata!evloc ;
> on evloc.evloc=events.evloc ;
> join tcdata!keyw ;
> on keyw.keyw=events.keyw ;
> join tcdata!estatus ;
> on estatus.estatus=events.estatus ;
> where events.mno=nmno .and. events.can=0 ;
> order by events.date desc ; && Need to order by another field and display
> into cursor boe

As John said, by re-issuing the SQL statement you rip the record source out of the grid, which causes it to blank. To avoid this you manipulate the RecordSource property as described. You may also use the view as a recordsource, then you just call REQUERY("myView") and refresh the grid. You may also index your view (or cursor) to change the desired order. You may index it only if it is in record buffering mode. If you want to use the view in table buffering mode, you still can have it indexed, you just need to switch it to record buffering for a moment (with CURSORSETPROP() function), index it and return to table buffering mode.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform