Help with relations

Hello, Adaloites!

I’m working on an app for my book club. Currently, I’ve 3 collections as of now: Users, Books, and Reviews. I had to set up relations between those three but I’m not sure if I did it right. Having a hard time building app in Adalo, I definitely need someone to look at it and direct me on the right path. Example: A user can be an owner or a borrower, not sure how to set it up either.

Welcome to the community @raghavendra.philkana!

We have a lot of tutorials and help documentation that will get you wokring with relationships in no time! An entire list of these can be found here: Resources & Tutorials. (Please read before posting)

I would recommend the “Working with data” one which will help you understand the concepts more.

I checked some videos from youtube, but i’ll go through the links you gave. and will reachout if I still can’t figure out.

Hello @raghavendra.philkana and welcome! Adaloites? Is it an official thing? :joy: I like the sound of that but I think Adalolites is easier on the tongue :slight_smile:

Anyway, just to help you out a bit:

In your users collection, you can have a true/false property if you want to restrict a user from being both a borrower and owner, although I think a user should be able to borrow and lend books.

How I would do it is to set up relations first:

  • Books and reviews (one to many)
  • Users and reviews (one to many)
  • Users and books (one to many) — lender
  • Users and books (one to many) — borrower

Books collection properties

  • Standard details such as name, author
  • True/False for borrow status

Two screens — one for submitting books to the club, one for borrowing books from the club

Submit books — just a plain form that creates a record in the books collection
Borrowing books — a list of books submitted, with the condition that it’s not borrowed already OR if the book is borrowed, hide the “request book” button

If you want reviews for the books, make sure you have a button on the book details page that leads to a page of reviews, and a form to submit a review.

I think that should give you a rough idea and direction of how to implement it.

Hope it makes sense!

2 Likes

@vancewong Hahaa … I just wanted to highlight Adalo as it is such a great tool for non-coders like me.

Relations:

  1. I did set it up already the same as you said, but with some additional relations that were not needed and I removed them now (based on what you said).

  2. Added status in Books collection - True/False option made it damn easy to track.

  3. a) Submit screen - that was the plan and I did it now.

I’ve two questions:

Is it right if I add two more fields one to know who is lending the book now (owner) and who is borrowing (borrower)? Yes, a user can be both a lender and/or a borrower.

The submit book form doesn’t fit inside the workspace … not able to re-size. See attachment.

Hey @raghavendra.philkana, yup. Each user should have two relations with books.

One as a lender/owner, and the other as a borrower.

So you can add and remove users as borrowers when they borrow or return the books respectively.

For the form — click on the title of the screen at the top, when you see a transform box around the screen, you can resize it like how you would with an image or table in a word doc.

Cheers!

1 Like

@vancewong Both tasks done! thank you :slight_smile:

1 Like

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