Hi everybody, I am working on a project where I have a products table, an order table and a cart table. To make the long story short and illustrate the problem I have I have made an example with just one user.The orders tables has only to columns:
id (key)
state (text, ie. open, closedโฆ)
When a new row is added to the orders table an id is generated automatically and the state is set to โopenโ
The cart table has 3 columns:
id (key)
product id (a ref to a product)
order id (a ref to the order id)
The idea is to be able to add products to the cart and that they all belong to the same order. The app will be quite simple: for example, to start with we will not allow the user to have more than one order opened at the same time. The solution I came with is the following (bear in mind that I am a python developer and I have been with app sheet for a week):
Now the question is:
How and when do we create the new entry in the order table?. My original idea was to make the AddToCart action a group of actions: the first act on the order table creating a new row when there is no previous order with an โopenโ state: the second would act on the products table and would just add the product to the cart table (all columns would be filled as in point 1 above).
But I canโt make it work: the โGrouped: execute a sequence of actionsโ can only work on ONE table and I would need it to act on two of them: the order table and the product table. Any ideas on how to do this? Thank you very much in advance!
Gabriel Vidal
I just did it from the products table with a โadd a new row to another table using values from this rowโ adding a row to the order table only when the following condition is met:
ISBLANK(FILTER (order, [state]=โopenโ))
User | Count |
---|---|
40 | |
34 | |
29 | |
23 | |
17 |