dbTalk Databases Forums  

Calculating Most Recent Related Data

comp.databases.filemaker comp.databases.filemaker


Discuss Calculating Most Recent Related Data in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
robdsteward@gmail.com
 
Posts: n/a

Default Calculating Most Recent Related Data - 11-25-2006 , 03:20 PM






Hello,

FileMaker n00b here. I searched Google Groups for an answer to this,
but couldn't find one.

I'm developing an event management database. It has an Attendee table,
a Registration table and an Event table.

When an Attendee purchases a Registration for an Event, the
relationships and portals are set up so that you can look at an
Attendee and see his Event history. Likewise, looking at an Event, you
can see all that Event's Attendees. (The Registration table is the "go
between" in this many-to-many relationship.)

What I need to do is determine, in a calculation, the city where an
Attendee most recently attended an Event.

I can easily get the most recent event *date* with
Max(Event::EventDate)... but how do I then "get at" the city where that
most recent Event took place?

I won't be at all surprised if I'm making this harder than it is.

Thanks!
-Rob


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

Default Re: Calculating Most Recent Related Data - 11-25-2006 , 04:36 PM






In article <1164489640.958274.157950 (AT) 14g2000cws (DOT) googlegroups.com>,
robdsteward (AT) gmail (DOT) com wrote:

Quote:
Hello,

FileMaker n00b here. I searched Google Groups for an answer to this,
but couldn't find one.

I'm developing an event management database. It has an Attendee table,
a Registration table and an Event table.

When an Attendee purchases a Registration for an Event, the
relationships and portals are set up so that you can look at an
Attendee and see his Event history. Likewise, looking at an Event, you
can see all that Event's Attendees. (The Registration table is the "go
between" in this many-to-many relationship.)

What I need to do is determine, in a calculation, the city where an
Attendee most recently attended an Event.

I can easily get the most recent event *date* with
Max(Event::EventDate)... but how do I then "get at" the city where that
most recent Event took place?

I won't be at all surprised if I'm making this harder than it is.

Thanks!
-Rob
One way (there may be others):

Do a Find for the events which that person attended, sort the found set
by date, go to the most recent (either first or last, depending on the
Sort order), and get the city.

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


Reply With Quote
  #3  
Old   
robdsteward@gmail.com
 
Posts: n/a

Default Re: Calculating Most Recent Related Data - 11-25-2006 , 04:40 PM




Bill wrote:
Quote:
In article <1164489640.958274.157950 (AT) 14g2000cws (DOT) googlegroups.com>,
robdsteward (AT) gmail (DOT) com wrote:

Hello,

FileMaker n00b here. I searched Google Groups for an answer to this,
but couldn't find one.

I'm developing an event management database. It has an Attendee table,
a Registration table and an Event table.

When an Attendee purchases a Registration for an Event, the
relationships and portals are set up so that you can look at an
Attendee and see his Event history. Likewise, looking at an Event, you
can see all that Event's Attendees. (The Registration table is the "go
between" in this many-to-many relationship.)

What I need to do is determine, in a calculation, the city where an
Attendee most recently attended an Event.

I can easily get the most recent event *date* with
Max(Event::EventDate)... but how do I then "get at" the city where that
most recent Event took place?

I won't be at all surprised if I'm making this harder than it is.

Thanks!
-Rob

One way (there may be others):

Do a Find for the events which that person attended, sort the found set
by date, go to the most recent (either first or last, depending on the
Sort order), and get the city.
Please correct me if I'm wrong, but that cannot be done in a
calculation, can it?

Thanks,
-Rob



Reply With Quote
  #4  
Old   
Grip
 
Posts: n/a

Default Re: Calculating Most Recent Related Data - 11-25-2006 , 06:34 PM



In your relationship between Event and Registration, sort by date,
Descending. And unsorted between Registration and Event. If you put a
portal of Events on Attendee, the topmost record should be the most
recently attended event.

A simple calculation Attendee::LastCity = Event::City should pull the
first related record, ie the most recent Event.

G



robdsteward (AT) gmail (DOT) com wrote:
Quote:
Hello,

FileMaker n00b here. I searched Google Groups for an answer to this,
but couldn't find one.

I'm developing an event management database. It has an Attendee table,
a Registration table and an Event table.

When an Attendee purchases a Registration for an Event, the
relationships and portals are set up so that you can look at an
Attendee and see his Event history. Likewise, looking at an Event, you
can see all that Event's Attendees. (The Registration table is the "go
between" in this many-to-many relationship.)

What I need to do is determine, in a calculation, the city where an
Attendee most recently attended an Event.

I can easily get the most recent event *date* with
Max(Event::EventDate)... but how do I then "get at" the city where that
most recent Event took place?

I won't be at all surprised if I'm making this harder than it is.

Thanks!
-Rob


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

Default Re: Calculating Most Recent Related Data - 11-25-2006 , 07:34 PM



In article <1164494416.813282.284620 (AT) f16g2000cwb (DOT) googlegroups.com>,
robdsteward (AT) gmail (DOT) com wrote:

Quote:
Bill wrote:
In article <1164489640.958274.157950 (AT) 14g2000cws (DOT) googlegroups.com>,
robdsteward (AT) gmail (DOT) com wrote:

Hello,

FileMaker n00b here. I searched Google Groups for an answer to this,
but couldn't find one.

I'm developing an event management database. It has an Attendee table,
a Registration table and an Event table.

When an Attendee purchases a Registration for an Event, the
relationships and portals are set up so that you can look at an
Attendee and see his Event history. Likewise, looking at an Event, you
can see all that Event's Attendees. (The Registration table is the "go
between" in this many-to-many relationship.)

What I need to do is determine, in a calculation, the city where an
Attendee most recently attended an Event.

I can easily get the most recent event *date* with
Max(Event::EventDate)... but how do I then "get at" the city where that
most recent Event took place?

I won't be at all surprised if I'm making this harder than it is.

Thanks!
-Rob

One way (there may be others):

Do a Find for the events which that person attended, sort the found set
by date, go to the most recent (either first or last, depending on the
Sort order), and get the city.

Please correct me if I'm wrong, but that cannot be done in a
calculation, can it?

Thanks,
-Rob
You are right. It can be done in a script.

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


Reply With Quote
  #6  
Old   
Frank Dwyer
 
Posts: n/a

Default Re: Calculating Most Recent Related Data - 11-25-2006 , 09:13 PM



robdsteward (AT) gmail (DOT) com wrote:

Quote:
Hello,

FileMaker n00b here. I searched Google Groups for an answer to this,
but couldn't find one.

I'm developing an event management database. It has an Attendee table,
a Registration table and an Event table.

When an Attendee purchases a Registration for an Event, the
relationships and portals are set up so that you can look at an
Attendee and see his Event history. Likewise, looking at an Event, you
can see all that Event's Attendees. (The Registration table is the "go
between" in this many-to-many relationship.)

What I need to do is determine, in a calculation, the city where an
Attendee most recently attended an Event.

I can easily get the most recent event *date* with
Max(Event::EventDate)... but how do I then "get at" the city where that
most recent Event took place?

I won't be at all surprised if I'm making this harder than it is.
Provided only one event can occur on any given day, create a
relationship from the EventDate in Attendees (your calc field above) to
the Date in Events. You can then show the EventCity related to the date
shown.

If you want more than one Event per date:
-Create an auto-entered serial number field in Events ("EventNumber")
and populate it.
-Create a lookup field in Registration to grab the EventNumber when
adding an Attendee.
-Create a relationship from Attendees to Registration based on the
AttendeeName (or number, if you're using one, which you should).
-Create a calc field ("MaxEventNumber") in Attendees =
Max(Registration::EventNumber)
-Create a relationship from the "MaxEventNumber" field to the
"EventNumber" field in Events.

You may then pull the most recent EventCity into Attendees.



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.