New Action: Add a Row to a table

@praveen. Had a look at it last night. Couple of questions. Maybe I am missing how.

  1. How do you add multiple rows, meaning for multiple rows that fits a criteria or rule
  2. I see Columns marked as REF in the Parent table is not available in the list if Columns one can select. I have a case where I want the value in that REF column to also be “defaulted” to the Child Table Record
2 Likes

Here’s a sample: https://www.appsheet.com/Template/AppDef?appName=Customers3-16350

It is a variant of the OrderCapture sample. It has three actions and a workflow rule:

  1. ‘Prefill 2 Apples’: the action is on the Orders table and it adds a LineItem row for that Order, asking for 2 apples
  2. ‘Prefill 3 Bananas’: the action is on the Orders table and it adds a LineItem row for that Order, asking for 3 bananas
  3. ‘Prefill’: the action is on the Orders table and it composes the previous two actions. It can be invoked directly via a UI button (try it in the app) or via a workflow rule.
  4. A workflow rule that runs when a new Order is added — this automatically calls the Prefill action (which adds two LineItems to the order)

Now, I’ve marked this as a public sample, so that any of you can see it. However, this means you will not be able to save/sync any updates. So if you’d like to play with it, especially the workflow rules, please make a copy.

6 Likes

This is awesome! i’ve been waiting for this for a long time!! Thank you so much! :smile:

1 Like

Hi Praveen

Just checking. It it possible to only create new one row per action?

I’m going to be building an App where it will need to do the following:
A row in TableA is changed
Based on a matching condition - TableA[ColumnA]=“Banana”
It copies all rows from TableB to TableC where TableB[ColumnA]=“Banana”
TableC is a subtable of TableA

Will this be possible or is it a Google Script job?

Simon@1minManager.com

1 Like

@praveen

Hmm but that is pre-set to add 2 rows.

Here’s a typical scenario I get faced with.

Imagine we have a MASTER table which has an EnumList field called LINE-ITEMS which contains 5 choices - ‘Andrew’,‘John’,‘Tim’,‘Dave’,‘Mike’.

Naturally, I have got a DETAIL table where i expect the new line-item rows to be created based on my choices in the EnumList.

I then go ahead and create a new MASTER entry and select choices ‘John’, ‘Tim’, ‘Mike’.

The app then should create the following entries in the DETAILS table

+------------+-----------+
| DETAIL_UID | LINE-ITEM |
+------------+-----------+
| 1          | John      |
+------------+-----------+
| 2          | Tim       |
+------------+-----------+
| 3          | Mike      |
+------------+-----------+

If I was to use your method, I would have to have a Grouped Action specifically for the scenario of the EnumList containing John, Tim, Mike… which means that I will be forced to create a ton of Group Actions for each possible combination.

I still think it’s a nice addition to have though, i don’t think it’s for me at this point (unless i missed something) :+1:

2 Likes

@praveen, this is EXCELLENT! Thank you!

How would this work when you want to copy a different number of rows each time?

e.g. A Customer wants to repeat an Order, with all related Line Items. Each time they want to copy a different order, with a different number of line items- copied to the new parent Order.

Would we have to just guess at the max number of related rows (Line Items) per Order, and have that many individual actions grouped to copy them? How do we loop through the list of REF_ROWs when the number of values is not fixed?

2 Likes

Great to hear, been waiting awhile for this feature!

1 Like

Hi Simon, here’s how to model this:

  1. Define an action on TableB that copies a row over to Table C
  2. Define a “reference” action on TableA … it identifies a set of rows in TableB and for each of them, invokes an action (the one you defined in step 1) on that row
  3. Now trigger the reference action via a workflow rule with the matching condition.
1 Like

Hi Alex, here’s how you would achieve that.

  1. have a separate Details_Template table with five dummy rows in it, one for each of the choices.
  2. Define an action on this Details_Template table to copy a row into the Detail table
  3. Now define an ‘reference’ action on the Master table … this defines an expression that identifies a set of rows in the Details_Template table (those whose name matches something in the enum list column of the Master row) and invokes the copy action (defined in Step 2) on them
2 Likes

Combine this new kind of action with a reference action.

In a reference action, you provide an xpression to compute a set of row references. And an action to take on each of those rows. If you invoke an action that creates a new row in another table (effectively a “copy”), then it achieves what you want, I think.

3 Likes

Great, then i dont need to struggle with API and testing on Postman !!! This will save massive time.

1 Like

Love you guys! I’m a med student who doesn’t have much time to tinker with webhooks and this is going to make my med app dreams come true!

3 Likes

I tested this and working perfect. Thank you for implementing this awaited feature!

On the backend, API POST call should be running. POST methods could be relatively simple rather than Update row(s), but does your team have a plan and roadmap to introduce similar for the other verbs , especially, update!

2 Likes

… Including HTTP GET

1 Like

Very true, thank you.

Thank you for that new feature.
I used a form with EnumList. After saving, every item in the EnumList gets a new row in the child table. That will help us speed up the processes.

3 Likes

@Fabian. Can you guide us through the steps how you did this please. This is awesome functionality
BTW how do you get the Enum to pop up after clicking in that Action? :wink:

@Henry_Scott
Use of LINKTOFORM deeplink with that action and activating “Advance Forms Automatically” property from UX > Options > Forms produces the result

1 Like

@LeventK, thank you, let me try that out

Hmmm… It seems that some initial values are not being calculated when you create a record via this new mech.

App formulas are calculated, the columns that are set with the data action are set - but all initial values aren’t evaluated, some are simply missed.

@praveen
App: TTGamma-96620
Version: 5.102072
Table: Line_Items
Columns: LineItem_Title, LineItem_Rate

Action (on the Invoices table) that creates the Line_Item row:
Create | Auto Invoicing Item
CloudApp