Shopping list design

Hi all!

I am creating a recipe app that will have a shopping list feature that will, when a user hits a button on the recipe card, will transfer the Ingredients from the recipe to a Shopping List table.  The shopping list is a collection of ingredients from one or more recipes, and should there be ingredients that have the same product (ie Celery) and unit (ie cups), it will sum up that product and unit.  Otherwise, if the product is the same and the unit is different, it will list it as separate items. In addition, some recipes might have two instances of the same product in the ingredient list, and the same idea applies to those.

Is there a better way to design this feature?  Currently, I have got so far as to add the ingredients to the shopping list from the recipe card, but I am not sure how to proceed with summing up each unique item.  Should I create another table to filter by product and then sum?  Or maybe a way to sum it up as it is adding to the Shopping list?  Any ideas or suggestions are very much appreciated.

Ingredients Table

anthropaulogy_0-1644780550347.png

Shopping List Table

anthropaulogy_1-1644780976154.png

Actions:

Add To Shopping Cart:  Attached to Recipe card.  Calls the Transfer Ingredients To Shopping List Action to operate on Ingredient Rows that refer to the same Recipe ID as the current recipe.

anthropaulogy_3-1644781132810.png

Transfer Ingredients: Attached to Ingredients table.  Transfers each row to the shopping list table.

anthropaulogy_4-1644781344825.png

 

 

 

0 1 312
1 REPLY 1

I think you are on the right track.  Personally, I would probably take the path of checking if a Product row exists in the Shopping list.  If it doesn't then add it.  If it does then update it. 

The updating gets tricky.  AppSheet enhanced the "add a row" action so it can add or update.  It will update if you supply the row ID/Key.  However, if you are updating you must provide all column values that do not automatically update or they will be over-written with blank values.  I have experienced some other issues just today and abandoned using the "update" option of that action.  Instead I created another approach to updating.

Another option for your use case might be to attach to the Shopping product row a list of recipe product rows.  Then you can SUM the quantities from the recipe list to get the Shopping quantity.  The side benefit is that you can provide to each user a way to easily see which recipes contributed to the shopping list - even for each product.  An additional challenge might be how to handle items added that are NOT part of a recipe.

Top Labels in this Space