To populate the global ('gID'), use SetField[], setting it to the value of
the PersonID that is hopefully someplace in the child table of the Person
portal. The PersonID doesn't need to be a field in the portal row.

I think we are all a bit confused about just what you are after, but it does
seem clear that you have started with a portal that displays the
relationship (let's call it 'Household_Person') from Household to Person.

If so, the child table, 'Persons', must have a primary key, 'PersonID'. You
can build a script or script step on a field in a portal row. This script
step can be:

SetField["Household::gID"; "Household_Person::PersonID"]

What you might be struggling with is that the global is in the Household
table, not the Persons table. The relationship it serves uses that global as
the left hand key, and Role_Person::PersonID as the right hand key, where
'PersonID' is the ID for the Person in the Role table.

The tab control might be a distraction in this discussion; they are useful
graphic controls, but they serve no structural purpose. By that I simply
mean, get the relationships working properly before worrying about the tab
control.

Note once again that that SetField will work only if it is the first step,
if you use a script at all (rather than just a single script step); after
that, the portal loses focus and you will always just get the first record
in the child table. So, you will be placing a button on a field in the first
portal.

John Weinshel
Datagrace
Vashon Island, WA
(206) 463-1634
Member, FileMaker Business Alliance
Certified For FileMaker 8
Certified For FileMaker 7



-----Original Message-----
From: FileMaker Pro Discussions [mailto:[email protected]] On
Behalf Of Ron
Sent: Sunday, December 14, 2008 3:09 PM
To: [email protected]
Subject: Re: 3 level relationship

Oh, I did screw that up.
Below the Person portal is a Tab Control.
Each Tab has a portal which displays one or more records for the Role
defined on the Tab.
Apologies for the confusion.

Now I can see that if I build a relationship between a global field which
contains a PersonID and each of my Role records, all I would have to do is
put the PersonId in the global field and GoToObject - the Tab control.
However, I do NOT see how to get the selected Person record ID into the
global field.

Thanks you again for your patience!

Ron

-----Original Message-----
From: FileMaker Pro Discussions [mailto:[email protected]] On
Behalf Of Steve Cassidy
Sent: Sunday, December 14, 2008 5:54 PM
To: [email protected]
Subject: Re: 3 level relationship

Hi Ron

Trying to follow this thread...

> Thinking about this some more I am still confused.

I think we are confused as well...

> My concept was two portals: one for the one or more person related  
> to Household.

Reasonable this far. Each household has one or more persons and these  
persons appear in a portal -- one row each.

> The second portal has the Tab control, where each tab goes to the  
> associated "Role" table.

I'm not sure if a tab control can be placed within a portal row. But  
perhaps we shouldn't be concerned with technical details at this  
stage...

So each row in this second portal shows what? A household person  
again? Or something else?

And if each row of the portal did have a tab control, what would each  
tab be showing?

> If I put a button on each Person record, than I can direct it to  
> the RoleTab control on the 2nd portal, but I am missing how the  
> relationship gets established, so the portals on the RoleTab  
> control know which Person I want.

Hmmmm... Thinking....

Are you wanting to click on a person in the 'first' portal and see  
more details of that person on the same screen? So you are on a  
record for the Cassidy household. On the left is a list of members:  
Steve, David, Alison, etc. Click on 'Steve' and on the right hand  
side of the screen you see details for Steve, including Steve's  
various roles? Then click on Alison to see details for Alison and her  
roles?

If that's it, then you do not need a portal on the right to display  
the person information. But since each person possibly has multiple  
roles, you could use a portal to display those. No tab control  
needed, though.

If this is what you want, then do tell. You will need a global  
containing the id of the clicked person. It would take a bit of  
explaining, but I or someone else will do it if we know this is your  
requirement.

> The Global ID idea I don't understand.
>
> Thanks for your patience.

If it's something else you are looking for, I think you will need to  
explain more clearly. In particular, you will need to answer my two  
questions above: what does each row of the second portal display and  
what does each tab in each portal row display?

Steve

Reply via email to