One-to-One Relationship?

I am trying to create a relationship between two databases that allow assets to be signed out like so:



Any asset can be signed to any person, but only once. I have managed to get the one-to-many working, but I can sign the same asset to TOM, SAM and SARAH at the same time. Once it is signed back in, it can be allocated to another person.

How would I go about setting up so once it’s assigned to someone, it disappears from the available list? Then reappears once it is returned?

1 Like

Hi David,

You can use a Many to Many relationship for this instead of One to Many or you can use Joint Tables!

With Many to Many relationship :

With Joint Tables:

Thank you

1 Like

Hi Dilon,

That’s an amazing level of support, thank you!

In my current setup, I am working with people in a database, not logged-in users.

I have a list that displays people, you select one and it allows you to assign an asset to that individual, by adding the asset to the main database in an appropriate column, like this:

What I would like to achieve, is the dropdown list does not display any asset that is already assigned to someone else. Is that possible the same way?

Sorry if I’m making daft statements, I’m brand new here from AppSheet so I’m relearning how to work.

1 Like

Your Welcome!

It means that a Asset can have only one user. Correct?

1 Like

Hi Dilon,

This is it! Great work, thank you.

Just so I understand the logic, are we telling the function to only display the devices with no users attached?

Strangely, my dropdown doesn’t display the currently assigned asset as yours does, other than that, working as intended - thanks again.

1 Like

Your Welcome!

Yes. You want the user to have many assets and a asset can have one user or a user can have one asset and asset can have many users?

To show that you need to add a OR filter like this.

1 Like

Yep, you were absolutely right.

I don’t really understand a lot of the logic in Adalo yet, I’m used to writing expressions that are mathematically logical, so this is different for me.

Thanks for all your help =)

My next task is to get the assets returned at the end of the day, I’m halfway there, they can be removed with a single button, but they never reappeat in the list. I’m getting something wrong with the relationships I think, as they appear as ‘Untitled’ in the database if you use the delete function.

1 Like

In that collection does the first property is empty? Then you will get that Untitled in the Database!

See this post by Mario:

1 Like

The issue appears to have been that using a Delete function on a Users Asset will delete the entire asset. It was appearing as Untitled because the database had no idea where the asset went.

Refreshing the page revealed the problem.

Is there a better way to clear the asset from a user with a single button press, instead of going through every dropdown and setting it back to ‘Select asset’?

Adalo documentation says that for 1:1 you just disregard the ‘many’ side of the relationship and consider to be ‘1’. In reality I don’t think it works as one would expect.

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