Adding In memory row to "Table" component

How do I add an in-memory row to the “Table” component without hitting the database?

@paragpkulkarni That’s not possible today. Would you like to add rows, and then submit them to the database soon after?

Thanks, Abhishek. I am facing difficulty in developing Order and OrderDetails screen. This is a scenario of one-to-many relationships. One Order has multiple OrderDetails items. So If I enter OrderDetails in the database then how do I enter OrderId in OrderDetails? If you have any examples of this then please let me know. Thanks.

I have a few questions to ensure I understand you correctly. Do you have one table with orders and another table with OrderDetails? Do you need to show the orderDetails in a container with some actions?

From what I understand today, here’s a solution. You could use the table widget to display orders and then use a list widget to show OrderDetails along with actions buttons. The OderDetails will be triggered by using the selectedRow property of the table. Would this work?

This problem is specific to creating a new order (insert operation) and not about showing the order and its details. Please refer to the below screenshot

Here is how the interaction will happen

  • End-user will select item, enter quantity and price and click Add button. There will be multiple rows for this.
  • Total amount, Cash, and Google pay will be entered manually
  • Details in order summary (Total amount, Cash and Google pay ) section go to Order table
  • The above operation should return OrderID
  • ItemID, Quantity, Price, and OrderID should be entered in OrderDetails table

So the problem is how do I insert a record in the Order table, get its ID and then add rows in the OrderDetails table with OrderID.
If in-memory operations are not supported then how do I achieve the above functionality

@Abhishek , any update on this?

For the above use case, The following could work

  1. Run an update/insert query by clicking Add button
  2. Refresh the table by running the query connected to the table widget again?
{{ => {

here query1 updates your datatable and then in the promise run the query 2 which will refresh your data

@paragpkulkarni Apologies.

There’s a solution that’ll work for you:

  1. You run an update or insert query by clicking Add button
  2. You can then refresh the table by running the read query again on success connected to the OrderDetails table widget. Running the query again would refresh the table widget.

Would this help?
Can we do a call? I don’t fully understand the usecase still :confused: My calendly link: Calendly - Abhishek Nayak

@Abhishek , I think the problem is not understood well. Let me try to break it further,

How do Insert into OrderTable and get OrderID in the output? I want to use this output in the next insert operation.

@paragpkulkarni you can run the insert query, fetch the orders sorted by last created timestamp and limited to 1 and use that id in the next insert operation.
{{ => => }}

Do let me know if this is still not clear :slight_smile: