Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Two tables in a grid linked
Message
De
25/08/2003 17:32:16
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
 
 
À
25/08/2003 10:21:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00821804
Message ID:
00823209
Vues:
20
I'm a little hazy and what you're trying to do (I see better with "pictures"), but it sounds like you want a recursive relation from "Password" thru "ass_mgr" back to "Password" via "emp_no" in order to retrieve a "Name".

If that's the case, you could open the "Password" table AGAIN (as PW2, for example) and then set a relation from PW1 to PW2 via ass_mgr to emp_no in order to retrieve the name; or, you can set the .ControlSource of the "Name" column to [IIF( SEEK( PW1.ass_mgr, "PW2" ), PW2.Name, "Not found" )].

Let me know if I "didn't get it" :)

>>Set the relation from the Parent to the Child (use SET RELATION).
>>
>>SET SKIP TO the Child
>>
>>Set the Grid's .RecordSource to the Parent
>>
>>Prefix the fields in the Column's .ControlSource with the appropriate alias (Parent or Child).
>>
>>>I have done this before but took a lot of time and still not sure how I got it to work...
>>>
>>>Is there in easy way to have a primary table in a grid and also have some fields from a secondary table and have it link and show the fields properly from the secondary table based on the relation of the link of the first?
>>>
>>>Everytime I do this, it seems to either show nothing in the grid, show the correct fields from both, but only on the current record and duplicate the info all the way up and down the grid and refresh when the row changes, etc. I always get various results and have to play with this to get it to work the way I want it to.
>>>
>>>
>>>Can anyone explain to me the best way to do this? Is it suggested to add these tables to the data environment and link them there, or is it best to open them in code and link them that way? How do I get the grid to display correctly at all times?
>
>
>___________________________________________________________________
>I still cannot get the result I want. I already had the appropriate columns with source to the correct tables, relation from parent to child, and grid's source to the parent. The set skip to I did not have. I tried adding this, but it is not seeking correctly. Let me give you an example of how one of my grid are set up and maybe you can see what I want to acheive:
>
>Parent = Borrower
>Child = password
>
>relation is by emp_no field (Employee number) parent to child
>
>The thing is the one to many relationship I need is there is ONE employee number for each person in the password table, but they may be assigned to MANY accounts in the borrower table. But, I need my borrower table to be the parent because the search screen I am using this on, I use various indexes based on the search they do to search in the borrower table. I display a field called the ass_mgr (asset manager) on the grid from the password which is the name of the employee which has their own emp_no (employee number), there can be many records in the borrower with the same emp_no in various spots. Based on the emp_no as the relation, I want it to show their name (ass_mgr) in the grid. I ran into this when I was doing normalization to the tables to take the whole name out of the borrower table (20 characters) and added them to the password table for each employee, then created the relation by that 4 character emp_no field to look them up in the password file. I just can't get them
>to display the asset manager (ass_mgr) correctly in the grid.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform