dbTalk Databases Forums  

one-to-many relationships and calculation fields

comp.databases.filemaker comp.databases.filemaker


Discuss one-to-many relationships and calculation fields in the comp.databases.filemaker forum.



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

Default one-to-many relationships and calculation fields - 05-25-2007 , 03:55 PM






Hello,

Let's say that I have a 3 schools in a city. Of course, each school
has many students. I know how to use portals and whatnot, but is
there a way to capture the one-to-many relationship in a single
Calculation field? For argument's sake, let's just, for formatting
reasons, say it is important that this be able to be done, not just
simply displaying portals the traditional way.

For example, here is what I would want the calc field to look like:

George Washington High
Jack Doe
Jill Doe
Thomas Jefferson High
Bill Smith
Ted Smith
John Adams High
Lewis Clark
Siegfried Roy

I was thinking a calc field in the "school" table that somehow
references the related records in the "students" table? This worked
for only one record (only one student showed up for each school).

HELP!!

Eric


Reply With Quote
  #2  
Old   
Helpful Harry
 
Posts: n/a

Default Re: one-to-many relationships and calculation fields - 05-25-2007 , 06:11 PM






In article <1180126520.956809.67110 (AT) q75g2000hsh (DOT) googlegroups.com>, EP
<ericp023 (AT) gmail (DOT) com> wrote:

Quote:
Hello,

Let's say that I have a 3 schools in a city. Of course, each school
has many students. I know how to use portals and whatnot, but is
there a way to capture the one-to-many relationship in a single
Calculation field? For argument's sake, let's just, for formatting
reasons, say it is important that this be able to be done, not just
simply displaying portals the traditional way.

For example, here is what I would want the calc field to look like:

George Washington High
Jack Doe
Jill Doe
Thomas Jefferson High
Bill Smith
Ted Smith
John Adams High
Lewis Clark
Siegfried Roy

I was thinking a calc field in the "school" table that somehow
references the related records in the "students" table? This worked
for only one record (only one student showed up for each school).

HELP!!

Eric
When related fields are used outside of a portal you do only get the
first related record's data, although there are excpetions with some
functions and when acessing fields via a script which loops through a
portal's rows.

I'm not sure quite what you're trying to achieve, but the best place to
produce something like that is a printed reported from the related
table itself (Students?), using a relationship link back to the main
table if needed to retrieve any School information. That way a simple
layout using a Sub-summary section and sorted by School will give you
exactly that report.

If for some strange reason you do need a single field to "calculate"
that structure, then you will need to use a Global field and script
that loops through each records and an inner loop that goes through
record's portal rows.



Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


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

Default Re: one-to-many relationships and calculation fields - 05-26-2007 , 09:30 AM



Quote:
When related fields are used outside of a portal you do only get the
first related record's data, although there are excpetions with some
functions and when acessing fields via a script which loops through a
portal's rows.

I'm not sure quite what you're trying to achieve, but the best place to
produce something like that is a printed reported from the related
table itself (Students?), using a relationship link back to the main
table if needed to retrieve any School information. That way a simple
layout using a Sub-summary section and sorted by School will give you
exactly that report.

If for some strange reason you do need a single field to "calculate"
that structure, then you will need to use a Global field and script
that loops through each records and an inner loop that goes through
record's portal rows.



Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)
Harry, The OP did not state version, but 8 has a brandspankingnew LIST
function. retrieving just what he needs.

list ( RelatedTable::Name )

Returns all related names to the current record as a list.

Keep well, Ursus




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.