Portal Filter Another Portal?

I want a portal that shows all the contacts.
If you click a contact I want to see a portal of all their invoices.

How Can i Do this?

Would the relationship be Contact ID to CONTACT ID Foreign key?

I think i'd approach it something like this:

  1. when you click a portal row, it sets a global field in the current table (or a connected table) with that Contact ID. E.g. your global might be MyTable::SelectedContactID
  2. then you have a relationship like MyTable::SelectedContactID = InvoiceSelected::CONTACT ID Foreign Key. Base your invoices portal on that "InvoicesSelected" table occurrence.

So every time you select a row, it changes the selected id and refreshing the Invoices portal will show only those for the selected contact.


Alternatively, if you base your current layout on Contacts, then you can use "Current Table" for your contacts portal, and a regular relationship to your related invoices in the layout body (Contact::id --< Invoice::id_Contact).