Hide used options in dropdown

Hi! I’m trying to assign assets to newly created employees in my app.

There is a RG which its type of content is Employees. Each cell contains the employee name and a dropdown to the right which shows unassigned assets. Also, in the bottom of the page, there is a save button which updates the employee database with the newly assigned assets. But here comes the issue.

Lets say there are 5 new employees and 7 unassigned assets. I want that the dropdown shows only the assets that haven´t been assigned in the current view (no in the database in general). So if I assign Asset 1 to New Employee 1, the next dropdowns should only display Assets from 2 to 7.

And also, in case a mistake is made. It should be possible to set the assigned asset of Employee 1 to blank, so it can then be assigned correctly.

Any ideas?

Hi there, @AAL… your post caught my eye, and I have been trying to come up with an example that works exactly as you have described, and I must admit I can’t do it. Well, I can’t do exactly what you have described, but I do have something working that is similar and might do the trick.

First, it’s not all that hard to remove options from a dropdown when they have already been selected. You could have a custom state that’s a list, and as options are selected, you add them to the custom state. Then, with the dropdown’s Choices source defined as the entire list minus the custom state’s list, you’re all set. Well, sort of.

The problem with the above, of course, is that as options are being removed from the dropdown, they can’t be shown as selected in the dropdown for each employee, and there is no way to save the selections to the database because the dropdowns don’t have values.

So, all of the above being said, the only thing I could come up with is that through auto-binding or the An input’s value is changed workflow action, you save the selections to each employee as they are selected, and you show the Current employee's asset (assuming you name the field asset) in another element in the repeating group. Then, with the dropdown’s Choices source defined as the entire list minus a list that is a search for employee’s asset, you get an experience that is very similar to what you have described.

If it helps, here is a screenshot of the dropdown configuration where I used an option set to define the assets and I used the User data type instead of a data type called Employee

Who knows… maybe I am missing something simple on this one, and someone else will be able to provide a much more straightforward solution. That being said, I hope this response is helpful, even if it’s just food for thought.

Best…
Mike

Hi @mikeloc!

Thanks a lot for the suggestion. I´m going to try!

I´ll be back with feedback, hope it works well

1 Like