Add pre-existing values by default

Hi, so in the ss attached, Select Recipes is a multi-select input and Save Recipes to User button updates the value chosen in the database.
Currently, it deletes the prestored value (any historical value) and updates the new input values. However, I want to add the new input values to the existing prestored value (any historical value). How do I do this?
One possibility I am looking to do that is to by default populate the existing prestored value (if any) in the Select Recipes input when a user is selected. If this can be done, how do I do that?

image

Hi @Shubh! I think approaching this with would depend on how your database is structured. If your data for each user is just an array of objects, it could be as simple as adding an additional object to your array every time you save a recipe to user. Could you share more about how your data is stored and how you plan to add data to it?

1 Like

Hi @Kenny, thanks for getting back. So, this issue got resolved.
However, another problem popped up. When a user is selected, the data gets pre-filled in the recipeMultiSelect input but it's not the data associated with the user selected. It is displaying the data of some other user. How can I fix this?

Hooray @**Shubh ! Happy to hear you were able to resolve the first part. **For your second part, it sounds like you will need to make your **recipeMultiSelect **dynamic depending on the user selected. You may be able to do this by creating a new transformer and writing a JavaScript Switch statement. The switch statement would be expected to return the correct array of 'select options' for your dropdown. Then you can set the **recipeMultiSelect's **default value with this newly created transformer with the switch statement.

I'm attaching an example of an app of what this looks like. I hope this helps! :slightly_smiling_face:
dropdown-20to-20dropdown.json