Adalo Database Relationships

Hello everyone,

I am creating a pharmacy delivery app but I am having a challenge getting to know which prescription is associated with which delivery order. I always have to do that manually for it to reflect the relationship.

Hi @William-Abrefa,

Welcome to the forums!

I guess you need to create a relationship between “prescriptions” collection and “orders” collection.

The type of relationship will depend on the business process: it could be many-to-many (if prescription could be used multiple times), or one-to-many (if prescription is “void” after the order, and order can have many prescriptions).
Also, you need to have a relationship prescription-user (many-to-one).

Hope this helps.

Best,
Victor.

1 Like

Thank you very much @Victor
I have created the relationship but it doesn’t reflect in the database.

If a user orders for a prescription, the prescription does appear in the user’s records automatically. I had to do it manually.
I hope you get me.

1 Like

Sounds like you need to add a Update when creating the prescription, and in that you would update the prescription field with the data entered.

2 Likes

Hi @William-Abrefa,

Seems that you’re not creating / updating the relationship with user when creating a Prescription.
It’s difficult to say exactly, as in your screenshots “Prescription” is a picture.
A short video would be useful for further diagnostics and advice.

Best regards, Victor.

1 Like

Alright. I will do just that.

@Victor @TonyD
Attached is a link to a video of me explaining the problem I faced.
Thank you

So first thing I noticed is your DB has 0(Zero) users.

Are the pages in your video after a user login (I’m guessing not).

So - make sure your users created and logged in, make sure your pages are after the login (link from the login page to the home page).

The pages in the video are after a user logins.
I will create a new user account and test again.
Thank you @TonyD

Hi @William-Abrefa,

Couple of comments from my side:

  • on the “Create Order” screen as I see you have a form with the Medicine name and Prescription image. You are not forcing the user to upload the prescription image in this form, so as a result you have empty images in the order.
  • on the same screen, are you linking the order to the user (i.e. in the form, set up an Automatic field, User set to Logged-In user)? As @TonyD mentioned you don’t have any user created, so it’s difficult to see if you’re adding the user to the order or not.
  • why have you decided to separate Orders and Delivery Details collection? This is feasible only if you have several Orders for one Delivery Details. But then you need to create a relation between these 2 collections, which you don’t have.

Best,
Victor