dbTalk Databases Forums  

Relationship 1..m

comp.databases.filemaker comp.databases.filemaker


Discuss Relationship 1..m in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Woody
 
Posts: n/a

Default Relationship 1..m - 04-01-2007 , 12:11 PM






Hi,

I'm looking for help with a simple two-table database as follows:

Table1: Individuals
Table2: Companies

The idea is that companies have a specific address, while individuals
associated with a company have their own name/title/direct-phone etc.
I want to have one table that lists companies and their addresses, and
then I want to be able to assocaite one Company record with multiple
Individual[s] records.

Table1: Individuals
- Has a FK_companyID:number field

Table2: Companies
- Has a PK_companyID:number;serial field

I made a relationship between them. I enabled the setting such that
records in Company can be created from Individuals. I added fields
from Table2:Companies to a layout having fields from
Table1:Individuals, and sure enough it works fine: If I type in any of
the 'Companies' fields while editing an Individual(s) record, then a
new record is added to Companies.

--

The problem is this: When editing an Individual's record, I want a
drop-down box to be available that lists all of the existing companies
in the Companies table. If the user selects one of those companies, I
want the ::companies fields to update live and show the associated
data from the ::companies table (not copy them into the local table,
just reference them). If the company record hasn't been entred yet,
then I want the user to start typing in the information to create a
new company record on the fly.

I made a Lookup List defined by a companies::Company_Name and I set
the field on the layout to use that, and it does give me a list of the
companies::Company_NAme[s], but when I change the selection, it
doesn't populate the other companies:: fields on the layout.

I would expect that the drop-down list, when changed, would change the
cursor of the companies:: table and resync the current layout's
associated fields (coming from a delphi background) - but it doesnt'
do that.

Any suggestions?

Thanks
Woody


Reply With Quote
  #2  
Old   
Bill
 
Posts: n/a

Default Re: Relationship 1..m - 04-01-2007 , 02:17 PM






In article <1175447475.891046.21030 (AT) p77g2000hsh (DOT) googlegroups.com>,
"Woody" <gotwoody (AT) gmail (DOT) com> wrote:

Quote:
Hi,

I'm looking for help with a simple two-table database as follows:

Table1: Individuals
Table2: Companies

The idea is that companies have a specific address, while individuals
associated with a company have their own name/title/direct-phone etc.
I want to have one table that lists companies and their addresses, and
then I want to be able to assocaite one Company record with multiple
Individual[s] records.

Table1: Individuals
- Has a FK_companyID:number field

Table2: Companies
- Has a PK_companyID:number;serial field

I made a relationship between them. I enabled the setting such that
records in Company can be created from Individuals. I added fields
from Table2:Companies to a layout having fields from
Table1:Individuals, and sure enough it works fine: If I type in any of
the 'Companies' fields while editing an Individual(s) record, then a
new record is added to Companies.

--

The problem is this: When editing an Individual's record, I want a
drop-down box to be available that lists all of the existing companies
in the Companies table. If the user selects one of those companies, I
want the ::companies fields to update live and show the associated
data from the ::companies table (not copy them into the local table,
just reference them). If the company record hasn't been entred yet,
then I want the user to start typing in the information to create a
new company record on the fly.

I made a Lookup List defined by a companies::Company_Name and I set
the field on the layout to use that, and it does give me a list of the
companies::Company_NAme[s], but when I change the selection, it
doesn't populate the other companies:: fields on the layout.

I would expect that the drop-down list, when changed, would change the
cursor of the companies:: table and resync the current layout's
associated fields (coming from a delphi background) - but it doesnt'
do that.

Any suggestions?

Thanks
Woody
Sounds like you need to define your value list of companies as using the
values from the field pk_CompanyID, and also show the value from a
second field, that being company name. IN FMP 8.5 you can further define
the value list to show the second field only.

Then you associate the value list with the field FK_CompanyID in the
individuals table.

Now when you click in the field FK_CompanyID in the Individuals layout,
the value list of company names should appear. When you select from the
list, you are actually filling the field FK_CompanyID with the company
ID, not with the company name. The relationship should now be complete,
and the other fields from the Company table should show up with their
proper values.

--
For email, change <fake> to <earthlink>
Bill Collins


Reply With Quote
  #3  
Old   
Woody
 
Posts: n/a

Default Re: Relationship 1..m - 04-02-2007 , 06:11 AM



Thanks, Bill. That was the correct solution.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.