Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with grids and multiple relationships
Message
De
24/04/2001 12:14:25
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00499076
Message ID:
00499087
Vues:
16
>I am having a problem with a grid when the recordsource for the grid has relationships set into more than one parent table. In my scenario, I am adding items to a package. For each line item, I show the description and the item category name. The item description and category name are displayed by means of a relationship between the line item and the parent tables. When the item code is changed on the line item, I get inconsistent behavior. Sometimes I receive a "Record out of Range" error. Other times the grid turns white and all columns and rows disappear. When I'm lucky the item description and category name will both be updated, but when this happens one of them will contain the wrong value. I've confirmed that the incorrectly displayed value is the same record number as the correctly displayed one. In other words, if the category name is displayed correctly and is record number 9, I will see the description for record number 9 in the items table. Has anyone else run into
>this problem before?
>
>I've been able to duplicate the problem with VFP sample data. If you'd like to do the same, use the data in the Data folder of the VFP98 samples directory. Use the following steps:
>
>1. On a new form, add the orditems, orders, and products tables to the data environment.
>2. Remove the automatic relationships.
>3. Set a relationship from the order_id field in orditems to the order_id index in orders.
>4. Set a relationship from the product_id field in orditems to the product_id index in products.
>5. Add a grid to the form with orditems as the recordsource and columns for orditems.order_id, orditems.product_id, orders.to_address, and products.prod_name.
>6. Save and run the form.
>
>I know this isn't a realistic setup, but it illustrates the problem I have in my real world scenario. On my computer, when I change the value of the order_id to another valid value (say " 10001"), the address updates properly, but the product name is also changed incorrectly to show the record in the products table with the same record number of the record in the orders table. Do you get the same results?
>
>I would really appreciate some help with this one. I've been wrestling with it for over two days now, and it's worth a lot of points <g>. Thanks.

Joel,
Those columns from other tables are readonly (just view) ? If so simple solution would be to use calculated fields. ie: with the sample you supplied remove all relations (and set order to none if you want)
*Controlsource for to_address
iif(seek(orditems.order_id,'orders','order_id'), orders.to_address,'')
*Controlsource for prod_name
iif(seek(orditems.product_id,'products','product_id'), products.prod_name,'')
This would even work with buffered grids.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform