2 Replies Latest reply on Dec 7, 2010 4:18 AM by PaulSmith

    Related Portals

    PaulSmith

      Title

      Related Portals

      Post

      Greetings,

      Briefly, is it possible to have a child portal display rows based on the currently selected line in a parent portal?

      I have:

      Invoices   (invoices::customerID  fk to customers::ID)

      Invoice details  (invoiceDetails::InvoiceID fk to invoices::ID)

      In my customer layout I would like to include an invoice portal which lists all invoices for the customer (this is working fine).

      When I navigate to a row in the invoice portal I would like the lines of the invoice detail portal to only display lines for the currently selected invoice.

      I can't make it work and would appreciate any tips anyone might offer.

      Many thanks

      Paul

        • 1. Re: Related Portals
          philmodjunk

          You need an extra relationship for your details portal. This will also require a second table occurrence of InvoiceDetails.

          1. Open Manage | Database | Relationships
          2. Click on InvoiceDetails to select it, then click the button with two green plus signs to make a new table occurrence for this table
          3. You can rename this box, SelectedInvoice.
          4. Define a new field ( I usually make it a global field ) in Customers, as gSelectedInvoiceID
          5. Create this relationship:  Customers::gSelectedInvoiceID = SelectedInvoice::InvoiceID fk
          6. Write a one line script: SetField [Customers::gSelectedInvoiceId ; Invoices::InvoiceID ]
          7. Now you can either put a button in the portal row, or select all the fields in the portal and use button setup to make them a button. Set this button to perform the above script.
          8. As a final touch, you can use Customers::gSelectedInvoiceID = Invoices::InvoiceID in a conditional format to specify a fill color for the fields in your Invoices portal so that the row of the selected invoice in your Invoices portal will highlight to show you which one is currently selected.

          If "Table Occurrence" is a new term, you might want to read this article:  Tutorial: What are Table Occurrences?

          • 2. Re: Related Portals
            PaulSmith

            Excellent. Thanks so much.