3 Replies Latest reply on Apr 30, 2014 11:20 AM by philmodjunk

    connecting a selected row in 2 portals



      connecting a selected row in 2 portals



           I 'm quite new to this and can't seem to find a way through this.

           I have a database with a parent table containing fields for a client (id, name, address, etc) and a child table containing fields such as appointment date, medication list, exam findings, etc. These two tables are linked via a foreign key in a 1-to-many relationship, since each client can have many appointments, and each appointment corresponds to a  single medication regimen, a single clinical exam, etc.

           In the layout, I have created the 1st portal containing only the appointment dates. In a tab, I have placed the exam findings, using a 2nd portal, sorted according to the appointment date. What I 'd like to do, is click on a specific date on the 1st portal (or a button inside there) and then have the other portal containing the exam data focus (move) to the corresponding results for that selected date.

           So far, I have only managed to see new appointment dates created on the 1st portal when i type in a new exam row in the second portal, but that's about it. 


           any help is appreciated


        • 1. Re: connecting a selected row in 2 portals

               You would appear to have these tables and relationship:


               Clients::id = Appointments::ClientID

               Define a field in Clients, named SelectedClient of the same data type as Clients::id.

               Make a new table occurrence of Appointments named Appointments|Selected.

               Add this relationship:

               Clients::SelectedClient = Appointments|Selected::ClientID

               Put  a Button in the portal row of your portal of appointment dates and set it to perform this script:

               Set Field [Clients::SelectedClient ; Appointments::ClientID ]

               On your tab, remove the current portal and fields from it.

               Replace them with fields from Appointments|Selected and when you click a button in your portal row, the fields on your tab will display data from the selected Appointment Record.

          • 2. Re: connecting a selected row in 2 portals

                 It worked like a charm (i only had to make a slight change, by relating the selected_client field with the Appointments_ID_FK)

                 thank you very much, great and clear answer!





            • 3. Re: connecting a selected row in 2 portals

                   Good catch on my mistake! It also confirms that you understand how the relationships and table occurrences used work.