Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 To: Roy Slough
  Where is Roy Slough?
 Potters Bar
 United Kingdom
 Roy Slough
 Tags
Subject: RE: Method of data retrieval for grid
Thread ID: 345357 Message ID: 345374 # Views: 51 # Ratings: 0
Version: Visual FoxPro 8 Category: Grids
Date: Wednesday, May 23, 2012 2:19:09 AM         
   


> Hi,
>
> I have done some work with grids on forms using the data environment for one/two tables.
>
> Now I have to create the "Main" grid search form which will include fields from many files including several links to an application codes file where all my code descriptions are.
> i.e. a status code in the order file links to a status description in the appcodes
> a method of receipt code in the orders file links to a description in the appcodes file etc.etc
>
> So far pretty normal stuff.
>
> Now I have read that it would be better to base my grid on a Cursor of data instead of the actual tables.
>
> When I add tables to the Data Environment of the form it creates cursors with aliases for me.
> Are these the cursors I should use and then when I want to filter the records apply filters to these
>
> OR
>
> DO I build an SQL statement in the code and then re-query when the user selects different selection criteria.
> (If so where do I put this SQL statement as when I run the form it either gives an error OR displays data from the most recent table opened)
>
> SO in summary, I could write a long SQL statement bringing in all the fields and making the links necessary, but how do I link the grid to it OR what method should I use.
>
> Thanks

Roy,
Grid has a property called RecordSourceType. Set it to 4 and then you can set your SQL as the RecordSource itself. It is pretty basic stuff but be sure to name your cursor uniquely and use it for the grid only. ie:

* Grid.init
this.Recordsourcetype = 4
text to this.Recordsource textmerge noshow pretext 15
select field1, field2, fieldN 
from myTable
where myField = thisform.SomeProperty
order by someField 
into cursor crsGridSource
endtext




Cetin Basoz

.Net has got better.Think about moving - check my blog:
My Blog
Blog (mirror) - sounds to be down


Support Wikipedia

ENTIRE THREAD

Method of data retrieval for grid Posted by Roy Slough @ 5/22/2012 9:16:05 PM
RE: Method of data retrieval for grid Posted by Mike Yearwood @ 5/22/2012 9:36:42 PM
RE: Method of data retrieval for grid Posted by Anders Altberg @ 5/23/2012 12:48:32 AM
RE: Method of data retrieval for grid Posted by Cetin Basoz @ 5/23/2012 2:19:09 AM
RE: Method of data retrieval for grid Posted by Jun Tangunan @ 5/23/2012 4:16:30 AM
RE: Method of data retrieval for grid Posted by Cetin Basoz @ 5/23/2012 11:31:46 AM
RE: Method of data retrieval for grid Posted by Jun Tangunan @ 5/24/2012 12:06:38 AM
RE: Method of data retrieval for grid Posted by Roy Slough @ 5/23/2012 12:32:11 PM