Accessing a simple list from a button

Hi (newbie here),

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.

Thanks.

Kâmi

Hello, you need to have a user database and a medication database.
Each remedy corresponds to a user.

To see it on the front:

In the admin panel you have a list of patients, click on the patient and send the current patient and all the linked information.

On this screen you can put a simple medication list for the current user, then it shows you everything you added to that user.

To add a medicine, add a bton that says add medication, then this medication is for current user

On the user front:

Show logged in user’s medication

Does this serve you?

@Santiago - Thanks for your help.

For the sake of clarity, I commented your entry.

My questions are below the screenshot.

Screen 1: Simple list of all patients which belong to the logged in
caregiver

Screen 2: The logged in caregiver clicks on one row in the simple list in screen 1.

Screen 3: How do I use the “current” patient id from screen 2 to query the medications table by the patient id value?

Can you show me

(a) how I can retrieve the “current” patient
on screen 3 coming from screen 2

and

(b) how I can use the “current” patient id on screen 3 to filter the medications table?

Thanks.

Kâmi

Okay, from what I understand, correct me if I’m wrong.

A caregiver has patients to care for, and each patient has medications.

The caregiver has a simple list of their patients on their homepage.

They access a patient’s information and see the patient’s details (name, photo, etc.) and a button that says “View Medications.”

That button needs to open a screen displaying the patient’s medications.

On that page, you need to add a list of medications, but not all of them; only the medications for the current patient.

That’s why you need to assign each medication to a specific patient.

Is this what you want to do?

@Santiago - That is exactly right.

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.

Thanks.

K.

1 Like

Hi @Kami,

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?

Thank you and have a great day!

Hi @Dilon, thanks for your help.

If that helps a bit (-:slight_smile:

  1. The logged in caregiver “My patients” simple list

  1. The patient details screen (after clicking on a name)

  1. The medications DB table structure (I checked. A row patient_username entry value is “ljackson”)

  1. Actions setup on the patient details screen

  1. Available fields on the Med Test Page Screen

For some reasons, the field I need (patient_username) does not appear. I am therefore unable to filter the Medications table
using that field value.

I must be doing something wrong.

Thanks.

K.

Hi @Kami,

Thanks for the screenshots!

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?

Thank you and have a great day!

Hi @Dilon,

Thanks a lot for your help.

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

(1)

(2)

(3)

(4)

Thanks for your help.

Kâmi

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.