Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Roy Slough
  Where is Roy Slough?
 Potters Bar
 United Kingdom
 Roy Slough
 Tags
Subject: RE: Ordering and Filtering in a grid
Thread ID: 345207 Message ID: 345209 # Views: 62 # Ratings: 1
Version: Visual FoxPro 8 Category: Grids
Date: Sunday, May 20, 2012 5:05:39 PM         
   


> Hi, I am displaying some records in a grid and I would like the user to change which subset (Filter)
> and then the order in which they are displayed.
>
> On the form I have a combo box selecting which subset (Filter) of records to display
>
>
> SET FILTER TO syscodes.Ccodetype = thisform.cboFilterby.Value 
> SET ORDER to TYPEORDER   && CCODETYPE+STR(ILISTORDER) 
> 

>
> Then on the click event of the column header I have
> N.B I am using CHR(187) + CHR(171) to indicate which sort method is in operation
>
> IF RIGHT(this.Caption,1) = CHR(171)
> 	SET ORDER TO cCodedesc ASCENDING 
> 	this.Caption = "Code Description " + CHR(187)
> ELSE 
> 	SET ORDER TO cCodedesc DESCENDING 
> 	this.Caption = "Code Description " + CHR(171)
> ENDIF 
> Thisform.grdSyscodes.Refresh()
> 

>
> Now Bizzarly the set order to ascending shows all the records in ascending order, but
> the set order to descending only shows one record
>
> What Am I doing incorrect?
>
> Thanks

GO TOP IN (Thisform.Grid1.RecordSource) 
*or 
LOCATE 


Does that help? BTW, there's a function DESCENDING( ) that can be used to determine whether the latest SET ORDER included ASCENDING or DESCENDING.


-Anders

ENTIRE THREAD

Ordering and Filtering in a grid Posted by Roy Slough @ 5/20/2012 4:00:15 PM
RE: Ordering and Filtering in a grid Posted by Anders Altberg @ 5/20/2012 5:05:39 PM
RE: Ordering and Filtering in a grid Posted by Stefan Wuebbe @ 5/20/2012 5:11:02 PM
RE: Ordering and Filtering in a grid Posted by Roy Slough @ 5/21/2012 3:00:21 PM
RE: Ordering and Filtering in a grid Posted by Stefan Wuebbe @ 5/21/2012 10:49:57 PM