Dropdown value should be holded onto the last created value

In my app I have a dropdown. What I want is whenver a user selects any value from the dropdown, that value should be holded by the dropdown. That means, whenever the user navigates to some other screen or closes the app, and comes again the previous value should be selected by default. Is that possible ?

Hi @Nitish,

You can use a property in Users collection for this.
E.g.:

  • dropdown represents some collection (it is a form of list). Add a relationship between Users collection and this other collection (let’s call it DDValues), so that one DDValue can belong to many Users, but one User can have only one DDValue
  • on a page where a user selects some value on dropdown, add a button/icon with the action. I believe you already have it, for example, to navigate to another page
  • add an action to this button: update Logged-in User → DDValue relation with the value from the Dropdown
  • and a final step: in the dropdown’s settings, set a default value (setting on the bottom) as Logged-in User → DDValue.

This solution works for the app with logged-in users.

Best,
Victor.

2 Likes

Hey @Victor this sounds good.

But in my case dropdown values are being selected from users collection

The case is, I have two types of users Gym Owner, Gym Member. So users collection is having a many-to-many relation with users collection. That is, a gym owner can have multiple gym members and one gym member can have multiple gym owners

Now, I have a dropdown that allows Gym Member to select from the Gym Owners he has. And hence the dropdown value is being derived from users collection.

Any solution for this ?

Hi @Nitish,

Did you try to apply same method for Users collection? Create a 1:M / M:1 relation, call it “AUXSelectedUser”, fill it in upon first dropdown usage and then use this property as a default for dropdown?

Best,
Victor