Relationship problem or database structure?

Hello !

I want to create an app where professionals will be able to offer services at the prices they want. Users will choose from a predefined list of services and then they will have to enter the price of the chosen service.

I managed to create a list of user’s services that I called “My services” in the app but I don’t know how to make the price specific to each user’s service.

I have tried several methods but I think the relationships are not good.

Here is what I tried:

  • I created a collection named “prices”
  • I related it to “services” and called it “the service’s price”

Here is the result :

In the last screenshot, you can see that I want to display the price but I can’t drop the price of the current service of the user

I could have used a One to One relationship between “services” and “price” but we can’t do it with Adalo :confused:

How can I solve this, I tried everything ?!

Hi @Ayoub ,

It is better to have price field inside the service collection, unless you want dynamic pricing, which need other fields to identify which one to choose.

If you are in the current scheme, you would need list to access the child collection (price) from parent collection (service) to get the list of prices.

1 Like

Hi @Yongki,

Thanks for your reply,

Indeed I want the pricing to be dynamic but I don’t want to add other fields. I tried to set automatic fields (login users & the current service) but It doesn’t work.

And what if I don’t want a list of prices can I still make it possible ? Or maybe I didn’t understand this part of your answer

Hey there @Ayoub

If the service only has 1 price, simply add a number parameter to the service and call it “Price”. Then, you can delete your price collection.

If the service has multiple prices, you need to use a list of Current Service > Prices to display the prices.

1 Like

@Ayoub , Why you created a collection for prices? To select a price from a drop-down? Why you don’t create a number property on the services collection and store the price there and show that property like Yongki mentioned? :slightly_smiling_face: If you do this in this way you need a list connected to the prices collection and filtered for the current service like Yongki mentioned!

Thank you

Hello @dilon_perera , Hello @Flawless

The price of the service is different for each user, for that reason It didn’t work when I create a number property one the services collection. Cause when I did, every users shared the same price.

With that number property on the services collection, How can I make it specific for each user ?

Btw creating a collection for prices seemed to be a good solution cause I want every user to fix his own price to a service :confused: but obviously it’s not a good solution

Oh like every user can add a price for the service? It’s like they added the service?

Check this video! :

1 Like

Thanks @dilon_perera

I think we are in the right path. I’m still trying to follow your instructions.
I understand the principle of creating a whole new services for the user cause it’s indeed like a creating a whole new service but I’m really lost right now I think I’m going to need a video

1 Like

If you are going by users too, the price collection should be related to users collection, so there will be 2 relationship fields, to projects and to users collection.

It is a good practice to use “id” field as a complement field, so when you are doing filtering you can use equal to this “id” field.

Hello guys,

A little update :
I have now 3 datacollections (Users, Categories services & Services)

  • I created a relationship between users and services (One user to Many services)
  • Relationship between categories services and services (One category to many services)

Here is the properties of “services” :

As you can see, the price is a property.

I have a list of the services choosen by the user (relationship user-services) :

There is a list of all services but I wanted to filtrer it and not showing the services already choosen by the user but it doesn’t work. I can’t select the user (current service > user)

Anyway, and then the user creates a service by fixing a price and setting automaticaly fields with all the current service’s properties

Sorry for the late reply @Ayoub!

Made a video! : ( Updated the above post too )

If you need made the app as clonable too : Services set price

1 Like

@dilon_perera my man !

I’ve been trying for so long ! Thank you for your video !
I didn’t know that we can select the sum for a price and add a custom filters.

Thanks again !

1 Like

Hi @dilon_perera

It’s me again. As you can see I change my ui a little.

I want to use a button “add” to add a service to my list of selected services. And when a user select a service he goes to page fix the price mendatory and when he fixes the price then the service goes to the list of selected services. And when he clics on a selected services he goes to “fix your price” to update the price.

How can I do that ?

I think it changes a lot of things here so I think I will go back and use “toggles” even if it’s not quite adapted

Add a update current service action to the Add button and for the selected user many to many relationship add logged in user and add a link action for the setting price screen.

It works. Many thanks @dilon_perera

1 Like

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