Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorry for being a numbskull - a grid question
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00065305
Message ID:
00065563
Views:
33
>>Hi folks, I am using VFP 3.0b for Windows.
>>
>>I have a really fundamental question about creating a 1 - many form that uses tables directly (no arrays, no views, no cursors).
>>
>>There seems to be two "true" VFP ways to create the form and set the relation between the two tables.
>>
>>1) Use the grid builder, this then sets the relation between the two tables. It seems in this case the tables don't have to be in the data environment.
>>
>>2) Put the tables into the data environment. Use drag and drop to relate the tables (if a persistent one doesn't already exist). Drag and drop the child table onto the form. The grid builder can then be run to set up the columns (not necessary), but the relation is not set between the two tables since the relation is set in the data environment.
>>
>>I have a few questions about these two methods, so I hope someone has time to answer them.
>>
>>A) Am I correct that these are two different methods, or am I confused?
>>
>>B) Which is the best method?
>>
>>C) I am using method 2, but I can't get the order of the child table in the grid. RFID is the primary key in the parent table and RFID is the foreign key in the child table. How do I set the child order. The child has a compound key that is a combination of RFID (foreign key) and date. This is the order that I would like the child table to be in. I can't get the form to child records to display in the grid properly by using the compound key or by setting the childorder property (in the dataenvironment) to what I want.
>>
>>So... if anyone can lend a hand to a rambling numbskull, I would appreciate it.
>
>For a 'numbskull question', you sure got a lot of participation in your quandry ;-)
>
>I handle grids a little differently, Evan, so I'm going to add my 2-cents US.
>
>1. Put parent and child tables into the DE (no relationship, if a relation shows, delete it in the DE, not the DBC)
>
>2. Set index to the foreign key in the child table, but add the sort-order to that index. The key would be "FK + LastName" to sort by last name inside the grid. Index tags are 'cheap' Add a couple if you need to change sort orders - FK + Company, FK + Region, etc.
>
>3. Use the grid properties (LinkMaster, ChildOrder) to set the parent child relationships.
>
>I've had excellent success with this method.
>

Barbara. It worked!



I was having trouble getting this to work because I had a few bits of "set relation" code hanging around in the form and grid methods. I think my original stumbling block was not deleting the the relation in the data environment (a concept which still seems illogical). But it is done...

I have been developing in VFP since Sept 95 (I think). My biggest project is a conversion from FP 2.6. I think this has seriously impared my learning curve with VFP. To this day I still develop in a strange mix of FP and VFP. This thread was the result of finally doing a 1 to many "right". As you can see I can sure rant... :-)

Thanks so much for your help and getting me over another hump. Now on to client server and the web...
Previous
Reply
Map
View

Click here to load this message in the networking platform