My question is more understandable by looking at the first screenshot below.
For some reason, I am unable to list all medications tied to a specific patient by a button click when the logged in caregiver is on the patient detailed list screen.
Any help/suggestions would be greatly appreciated. Thanks for your time.
Just one precision: Throughout the whole process, the caregiver does not add anything. He only reads.
(I, the developer, will take care of the database content.)
The only difficulty I am facing is passing the “current” (selected) patient id on screen 2 to the medications simple list on screen 3 (so that the medications DB table can be filtered by this “current” (selected) patient id on screen 3).
In the meantime, I managed to find an alternative connection between the screens but I am still very much interested in knowing how my original goal could be achieved.
You already created the relationship between patients collection and medications collection? Now you’re not seeing current patient data in the screen where you display the list of medications, to filter based on current patient? Any screenshots or a screen recording (can use loom.com) that would like to include?
Is the 5th screenshot about adding the filter into the medications list? ‘patient_username’ property is inside the medications collection so it doesn’t appear in the patients collection list of properties. Once you add that property (‘patient_username’ from medications collection) into the filter, then you need to add the property from the patients collection where the same value exits. I’m not clearly seeing, what is the property name called for storing the username of the patient in the patients collection? Is it, ‘Patient_username’?
Also I see you’ve created an one to many relationship, ‘User’ in the medications collection and would be ‘Medications’ in the users collection. But you’re storing the patients in another separate collection right instead in the user’s collection? Then that relationship doesn’t suitable which you need a relationship with the patients collection. May I ask, which user types should have login access? Is it only caregivers?
By some trial and error, I managed to get it working somehow.
(I believe my confusion essentially stemmed from my inability to decide which exact fields should act as foreign keys between
the three tables and how to name these foreign key fields.)
(1) logged in caregiver patients list → (2) patient details
→ (3) Patient medications list → (4) Patient medication details