Create many rows from table A to table B in one action but manually populating a value

Good morning.
I have two tables, products (parent table) and orders (children table).
Users would like to select multiple products and generate an order for each in a single action.
I configured an action 'add a new row to another table using values from this row' passing the fields needed in the created orders, it works fine.
The problem is that the user needs to populate the [customer] field of the orders table, when he activates the action and with the same value for all newly created orders.
How can it be done?
Thank you
 
Solved Solved
0 4 212
1 ACCEPTED SOLUTION

One way you can do this is

1) Create a table to capture a customer (USER[key], CUSTOMER[ref]) and set a security filter the USER column (i.e. [USER] = USEREMAIL())

2) In the action, "add a new row to another table using values from this row", you can set the following expression to retrieve the customer entered by the user

INDEX(SELECT(PickACustomer[CUSTOMER], TRUE), 1)

3) You can create a dashboard to display the PickACustomer_Detail and the Products table view for convenience. The user, however, has to navigate to the Products table view to execute the action because a dashboard view does not allow bulk select unfortunately.

This may not be ideal but at least gives you something to work with.

View solution in original post

4 REPLIES 4


@sergio_f wrote:

I have two tables, products (parent table) and orders (children table).


It may be that this structure is giving you grief.  It doesn't really make sense to have the Products table as a parent table to Orders.

Typically the way this would be structured is to have:

  1. Orders Table (Parent) - General info about order: Date, Customer, Order #, Total Cost, etc.
  2. Order Details (Child) - List of items to be ordered with Product, Quantity, Price, Subtotal, etc.
  3. Products - Referenced by Product column on the Order Details table.

When this is setup properly, AppSheet will automatically provide an Inline table of Order Details rows on the Order input Form so you can add each Order Detail row associated with the Order - choosing the Product, Quantity and adjust the Price (if needed).  The Order is automatically assigned as the Parent row but if you need additional details to carry over, maybe CUstomer, then you can use the reference to that Order parent row to grab them.

Does this help at all?

Thank you WillowMobileSys.
Yes, your advice is certainly useful, considering that it's an app that has been working for a long time, I wonder if there is a way to do what I need with this structure or if I have to modify it, which could be more laborious.
Thank you

One way you can do this is

1) Create a table to capture a customer (USER[key], CUSTOMER[ref]) and set a security filter the USER column (i.e. [USER] = USEREMAIL())

2) In the action, "add a new row to another table using values from this row", you can set the following expression to retrieve the customer entered by the user

INDEX(SELECT(PickACustomer[CUSTOMER], TRUE), 1)

3) You can create a dashboard to display the PickACustomer_Detail and the Products table view for convenience. The user, however, has to navigate to the Products table view to execute the action because a dashboard view does not allow bulk select unfortunately.

This may not be ideal but at least gives you something to work with.

thanks, good idea, works perfectly. even if it is not possible to activate a bulk selection I solved it by activating an inline action on the products, it seems pretty quick.

Thank you

Top Labels in this Space