Ho to make a default object selection.

1
I have two entity one is recipe and another is dish    For example for each dish object i have to map multiple recipes and should allow the user to choose only one recipe as default by clicking check box . for more understanding i have attached the screenshot of the exact scenario. Thanks in advance     
asked
1 answers
1

Hi Jagadeesh,

If the default is the same for all users, you can simply add a boolean on the entity and let that be set to true if it is default, and false for not default ones.

 

If it is different per user, I would create a seperate entity: Defaults with 2 associations, many to 1 to Account & many to 1 Recipe.

For each defaults you could get or create an object of that entity, and link it to the current user & the recipe. I would validate not to get multiple defaults for the same user & dish.

These screenshots provide a simplified version.

Upon screen loading you could then retrieve the defaults for the users, and over the defaults you would find the associated recipe for that specific user, and you can do the computations you want with those recipes.

answered