This is a portal to MedicalRecord_list?
And either HospitalAdmissionID or OfficeVisitID contains a value but not both?
Where/how do you want to display the Visit information of the clicked portal row?
On different layout? In a second portal? in a new window that pops up?
Yes, the MedicalRecord_list is a portal (just like a file cabinet with folders for hospital admissions and single sheets for just office visits all in a chronological order) so that when a portal row with the office visit is chosen, another layout or window for that particular office visit will show up.
When a portal row (in the MedicalRecord_list) with the hospital admission is chosen, another layout for the particular admission will show up with a new portal showing the various hospital visits for that admission. That is from one portal to another layout with a new new portal.
On second thought, I believe I shoud just create a field as a flag for either office visit or hospital admission in the MedicalRecord_list. Do you agree?
The fact that only one of the two key fields will contain data on any given record in the portal will serve the same functionas your flag field will it not?
This script can check that field and go to the new layout with the hospital visits portal on it:
If [ Not IsEmpty ( HospitalAdmission::HospitalAdmissionID ) // a hospital admission record exists ]
Go To Related Record [Show only related records; From table: HospitalAdmission; Using layout: "HospitalAdmission" (HospitalAdmission) ]
Go To Related Record [Show only related records; From table: Medical Record_List; Using layout: "Office Visits" (Medical Record_List ) ]
Thanks for the script.
I have revised the relationships. Kindly inform me if the following relationships would work:
My script was written so that it should work without any need to change your relaitonships. It did assume the presence of a different layout for showing the Office visits.
I do not see any need for adding a join table named Office_Visit Cabinet. It does not make sense to me to have a many to many relationship between office visit records and MedicalRecord_List.
Thank you for the information
I am not that good with the Relationships Graph.
Please inform me what I write below is what I understand from your comments
1 The first Relationships diagram that I sent you is the correct one
2 MedicalRecord_List table functions as a joint table between PatientData and the OfficeVisit tables
3 MedicalRecord_List table functions as a table with a portal between PatientData and HospitalAdmission tables (using Go To Related Record step)
4 MedicalRecord_List table requires both HospitalAdmissionID and OfficeVisitID for navigation to the proper HospitalAdmission Folder and the OfficeVisit record
5 HospitalAdmission table has a portal to all the hospital visits for that HospitalAdmissionID
1) I can't tell you that it's "correct", but I can tell you that it was the one for which I posted a suggested script.
2) In theory yes, but in practice, it looks like you will have one or zero office visit records that link to any given MedicalRecord_List record. That's not quite the typical "many to many" relationship that requires a join table. You need it here for the relationship to Hospital Admissions.
3) The portal should refer to MedicalRecord_List, the layout should be based on PatientData
4) It looks like you need one or the other, but not both which is how I understood this statement:
when there an office visit, there is no hospital addmission or vice versa
That strikes me as unusual as I have had family members that went to the doctor and the doctor promptly admitted them to the hospital when he determined that the problem was much more severe than my relative had assumed when they went to the doctor. But it's what you specified.
5) Don't know if it does or not. It's something that you can set up if you need it as your relationships support that option. (As an alternative, a portal to HospitalVisits placed on the PatientData layout will list all hospital visits for that patient and can be filtered to list only those for a specified admission.)