Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Portal relationship logic with aggregate functions

Featured Replies

Hello all, I'll start of with a basic schema of what I'm using then I'll describe my problem :

so I have 6 tables:

Event Donations 1:N (occurrence of the event table)

Donations N:1

-_DonationID

-_EventID

-_PeopleID (who donated it)

People 1:N

-_PeopleID

TeamMembers N:1 (bridge table)

-_PeopleID

-_TeamID

-MemberTotalDonations (calculated field of sum())

Teams 1:N

-_TeamID

EventTeams N:1 (bridge table)

-_TeamID

-_EventID

Event

-_EventID

where each cardinality applies to the table bellow (ex. 1 people can have many donations)

I have a layout based on the EventTeams layout with a portal currently based on TeamMembers. What I want to show in the portal on each row of a team member (the team members display correctly) is the MemberDonationsTotal that is related to that specific _EventID but what I get is an overall sum of all donations that person has made.

for ex. we have 2 people: foo and bar

foo participates in 2 different events baz and bax

foo donates $22 to baz and $33 to bax

bar only participates in baz and donates $38

if I show the event team that foo and bar were in (they were on the same team) for the baz event, foo shows a total donation of $55 and bar shows $38.

when I show the donationID on the rows as well it shows the wrong event ID for one of the people so I know it's pulling the wrong data.

Any ideas what to do to fix this? I can provide more info if it's too confusing.

Also what kind of joins does filemaker use? this looks kinda like a right outer join to me.

Let me rewrite what I understood about your structure (mainly for the sake of my own sanity):

People -< Donations >- Events -< EventTeams >- Teams -< TeamMembers >- People

Now, in order to see what you described you will need a chain of relationships:

EventTeams >- Teams -< TeamMembers >- People -< Donations

with the last relationship filtered by the currently viewed event.

This can be reduced to two relationships:

1.

EventTeams::TeamID = TeamMembers 2::TeamID

2.

TeamMembers 2::PeopleID = Donations 2::PeopleID

AND

TeamMembers 2::gEventID = Donations 2::EventID

The global gEventID field in TeamMembers must be synchronized with the EventID field of the currently viewed record in the EventTeams table; this can be done by triggering a script on RecordLoad in the EventTeams layout.

A calculation field in TeamMembers* = Sum ( Donations 2::Amount ) should produce the desired result.

---

(*) evaluated, of course, from the context of TeamMembers 2

Edited by Guest

  • Author

Ah it works! brilliant thank you!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.