FAQ: add row per value in EnumList

Add one row per value in an EnumList column list.

Try the sample app!

For this example, the table from which the row-addition process will be initiated is called Control Table. The table to which new rows will be added is called Target Table. Use your own names as you see fit. Note that they could even be the same table. Control Table must allow updates; Target Table must allow adds.

Control Table must have at least two columns for this process: EnumList (type EnumList; a list of Enum values; may be virtual); and Add Count (type Number; the number of the next row to add; may not be virtual). Column names may be changed as desired.

Add Count should be blank or zero initially.

Action 1: Add Rows for Remaining Values

This is the action that you should invoke to add the rows: it does everything.

  • For a record of this table: Control Table
  • Do this: Grouped: execute a sequence of actions
  • Actions: (added below, after creating actions 2, 3, and 4)
  • Only if this condition is true:
      isblank([Add Count]),
      ([Add Count] <= count([EnumList]))

Action 2: Increment Count

This manages the Add Count column value, which contains the index of the next value in the EnumList for which a row is to be added. It’ll start at 1 and increment to the count of items in the EnumList.

  • For a record of this table: Control Table
  • Do this: Data: set the values of some columns in this row
  • Set these columns:
    • Add Count: ([Add Count] + 1)
  • Only if this condition is true: TRUE (or blank)

Action 3: Add Row For This Enum

This action adds one row to the Target Table table for the Enum value of this row’s EnumList at the position indicated by Add Count (but only if the value isn’t blank).

  • For a record of this table: Control Table
  • Do this: Data: add a new row to another table using values from this row
  • Table to add to: Target Table
  • Set these columns:
    • Enum: index([EnumList], [Add Count])
    • (other columns as desired)
  • Only if this condition is true: isnotblank(index([EnumList], [Add Count]))

Action 4: Add More Rows

This action implements a loop by recursively performing action (1) for each successive value in the EnumList.

  • For a record of this table: Control Table
  • Do this: Data: execute an action on a set of rows
  • Referenced Table: Control Table
  • Referenced Rows: list([_thisrow])
  • Referenced Action: (action 1)
  • Only if this condition is true: TRUE (or blank)

Action 1

Return to action (1) and add actions (2), (3), and (4) to its Actions list.

  • Actions:
    • (action 2)
    • (action 3)
    • (action 4)

This looks very nice! I did everything the same as in the app and in your post. I see with ‘test’ that my row meets the Action 1 criteria. But the counter keeps blank (i start blank) So i think my action is never invoked. What could be the problem?

Schermafbeelding 2020-09-29 om 22.18.38


Please post a screenshot of your action 1.

@Steve I updated my post

1 Like

The action needs to be invoked in some way. In the sample app, the Form Saved event action for the control table’s form view is set to action 1. Did you do that?

1 Like

Thanks @Steve, this is really nice.
I followed all your instructions, but somehow Action 1, freezes the app, and all the tabs open in my browser for AppSheet, even my app gallery… This is really strange. I have to close all tabs in my browser to get it going again, and it all goes well until I invoke Action 1 by saving the form.
*Note: Control and Target Table are the same table

Here´s the screenshot for the actions, maybe you see something i don´t.

Sorry, I didnt put Only If condition for ACtion 1. Its working now!

My next question would be: How to only get the rows with individual Enum?
I dont want to have as well the EnumList divided by commas in my database.
Is that possible?
I would like to eliminate or hide somehow that first row.


I don’t quite understand. Is the row with multiple items the control row, from which the others were created? And you want that control row removed after the individual rows are added?

Hi @Steve, thanks again for your help!

Yes, that´s what I´m trying to do.
This is for an app which controls “meetings” for a biosphere reserve.
So, basically I have a table fed by a form that has all details of the meeting being created and to generate an automatic invitation to the meeting.
In this form I have an EnumList type column which enlists the “subjects” that are included in the meeting.
This should be enlisted in the invitation, but only those rows with a single item.

  • Another way, that may be easier, would be to find a way to enlist the items directly in the report from the control row with all the items. This way I wouldnt need to have an extra table for the rows created for individual items, nor all this sequence of actions.

So, basically from:

EnumList data: First Item, Second Item, Third Item

Get a PDF report with this data:
You are invited to the meeting, these are the things we will talk about:

  1. First Item [what would be the formula here?]
  2. Second Item
  3. Third Item

That’s just a matter of adding another action to delete the control row, then adding that action to the grouped action triggered by the addition of the control row.

Can you update records on Target Table if you edit (add or remove itens) from EnumList on Control Table? How to do that?

Hi Steve,

Thanks a million for sharing this, i have implemented it to ‘bulk create child rows’ and have no need for the control row either, i have added an action to delete the control row in the grouped sequence, however due to the recursive logic it looks the control row is being deleted after the first loop resulting in the first target row being deleted too

Do i need to apply your enum add count logic to the behavior in the delete action? if so, any ideas?

Please describe the logic your app is using. It’s likely going to be a simple change.

Thanks for replying, i have a 3 table hierarchy

Parent table - Orders
Child Table - OrderDetails (Control Table)
Grandchild Table - OrderDetail Materials (Target Table)

and i am trying to bulk create grandchild records that copy in the Parent Id, Child Id and enumlist values. I suppose the obvious fix is to create a separate control table instead of using the Child table, this way i wont need the delete action, doing it this way would create a many to many relationship between the Child and Grandchild if i have that correct.

The catch is i am wanting to execute your grouped action from the Grandchild table on a dashboard view, i have this working for the most part, using a linktoview overlay action

So you want the OrderDetails row deleted after adding all the OrderDetail Materials rows?

1 Like

Hi Steve, i have spent a bit longer with this feature and decided against giving it to the user as I believe the UX will be more intuitive with no delay when adding the child records. Using this enumlist method seems to take a while with my delayed sync turned on. Thanks for the assist tho

1 Like

Hi Steve

I tried to duplicate this exercise but I have issue because the “Add Count” not working, it is not counting “Enumlist”. I checked every step in actions with the same columns names from sample app but I did not success, also checked every columns in the table.

I copied the exercise “community30503” in my appsheet and it is working very well, but it does not work for me because I need to add this on another Apps.

is there some about “Add Count” I forget?