Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Many-to-many-one-to-many form
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00037823
Message ID:
00038171
Vues:
42
>>
>> I have table1 related many-to-many with table2, using table3, containing
>> the keys of table1 and table2 and related one-to-many with each. Table2 is
>> also related one-to-many with its child table4. I have a form used to
>> navigate and add to table1. When I add to table1, I relate the new record
>> to table2 by adding several records to table3. At this time, I can
>> generate a new record in table4 for each record in table2 which is related
>> to my new record in table1. So far, so good.
>>
>> Now I'd like to add a grid which displays all the records in table4 which
>> are children of the records in table2 related to the current record in
>> table1. This grid needs to display one or two fields from table2 (not the
>> key field) so that the table4 records can be easily identified. If I need
>> two adjacent grids to display those fields, that's OK.
>>
>> This app was designed for standalone use and has no views. That may change
>> in the future. The main purpose of this form is navigation, so it can't
>> afford to spend much time querying.
>
>Yup, sounds like you need two grids. The grid on the left has the
>Table4 and Table2 records, and the Grid on the right has the Table1
>records. The relationship should be set from Table4 to Table2, Table2
>to Table3, and Tabel3 to Table1. Thus the Grid on the right only
>displays the Table1 records that correspond to the Table2 record on the
>right side of the Grid on the Left Grid. Got it?

My persistent relationships, reflected in my Data Environment, were as you describe them. I don't need a grid to show table1 records. The current table1 record is displayed in the controls of the form. When I tried to make a grid like the "grid on the left", it gave me an error indicating that it didn't recognize the fieldname from table2. It seems like grids don't like to show data from more than one table. Also, the data in the grid was not being navigated. It seemed to be ignoring the relationships. When I navigate my form, I am SKIPping on table1.

I ended up doing something a little different that works pretty well. In my data environment, I removed the relationship between table4 and table2, and made table4 a child of table3, which is still a child of table1. Grid1 shows the records in table3 related to the current record on table1, displayed on the form. Grid2 shows the records in table4 which are related to the current record in table3. Clicking rows on grid1 makes grid2 navigate to the correct records in table4. It's not exactly what I had in mind. I wanted to show all grandchildren for the current record in table1 together in the grid, each grandchild's father identified by a column or two showing fields from the related records from table2 or 3 (whichever). Also, if grid1 is not selected, you can't see which of grid1's records is current, therefore you don't know which of them is related to the grandchildren in grid2. I know there was a thread here about the idea of having the selected record in a grid (grid1 for me) be highlighted somehow, even when the grid did not have focus. I don't remember if that thread ever found a solution, but I'd like to know if there is one. I'd also like to know how you get fields from multiple tables into a grid. My grid2 has a .RecordSource = table4 and .LinkMaster = table3. As I said, including a column with .controlsource = table3.field (or was it table2.field?) generated an error.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform