Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

Creating multiple rows based on the original one

I have 2 tables: Employees and Events. Event has a reference to Employee (1:1). What I want to achieve is to be able to select single Event and clone it with reference to the each of the Employee that user selects. I was trying to do it in many ways and nothing works. My blocker is that INPUT() cannot be used for action "add new row to another table...".

Anyone had similar case?

Solved Solved
0 7 347
1 ACCEPTED SOLUTION

The easiest way, of course, is to simply have the user create a new row and assign the Employee to each need row added.  But that is clumsy and time consuming.

To do it more efficiently, you need to be able to loop over your chosen list of Employees and add a new row for each choice.  To do that you will need:

1)  Add a column to allow multi-select from Employees to get the chosen list
2) Setup a set of actions to control and perform the looping.

In your use case, the idea is to choose a list of Employees and the Event.  Tap Save and then the actions pick off an Employee from the list, create a row in your desired table with that Employee and Event, adjust the list (either removing the Employee or bumping an index) and then repeat.

There are several posts in the Tips and Tricks on looping.  It's actually easy once you understand the concept.

Below are a couple posts to get started, there are others so feel free to search.  I'm certain you will have questions, so come back to the Community with your specific questions when you run into issues.

https://www.googlecloudcommunity.com/gc/Tips-Tricks/Looping-with-actions/m-p/223708#M75

https://www.googlecloudcommunity.com/gc/Tips-Tricks/Looping-with-Actions-Sample-App-BUILD-Video/m-p/...

I hope this helps!

View solution in original post

7 REPLIES 7

The easiest way, of course, is to simply have the user create a new row and assign the Employee to each need row added.  But that is clumsy and time consuming.

To do it more efficiently, you need to be able to loop over your chosen list of Employees and add a new row for each choice.  To do that you will need:

1)  Add a column to allow multi-select from Employees to get the chosen list
2) Setup a set of actions to control and perform the looping.

In your use case, the idea is to choose a list of Employees and the Event.  Tap Save and then the actions pick off an Employee from the list, create a row in your desired table with that Employee and Event, adjust the list (either removing the Employee or bumping an index) and then repeat.

There are several posts in the Tips and Tricks on looping.  It's actually easy once you understand the concept.

Below are a couple posts to get started, there are others so feel free to search.  I'm certain you will have questions, so come back to the Community with your specific questions when you run into issues.

https://www.googlecloudcommunity.com/gc/Tips-Tricks/Looping-with-actions/m-p/223708#M75

https://www.googlecloudcommunity.com/gc/Tips-Tricks/Looping-with-Actions-Sample-App-BUILD-Video/m-p/...

I hope this helps!

If you are using sheets as your data source, you might find it easier to accomplish this in appscript than in appsheet.  Claude.ai or chatgpt can help you create the script you need.  Appsheet doesn't really support looping.  I find it much easier to do looping in appscript.

Probably this is what I will end up with. I am just curious why it is not possible to run apps scripts  directly from action. It would be very helpful.

Btw. Is there any page, which shows the roadmap of features planned to be added to appsheet?

Abandon all hope of new features.  Trust me, it's better that way.  

@RedVox What do you mean?

Do you try to suggest that this system will be abandoned?

I couldn't find any better alternative for internal systems and truly believe in low-code/no-code platforms. Don't make me scary.

No.  But we rarely see suggested Feature Ideas implemented.  When AppSheet was founded, they were very good at using feedback to implement new features.  But even before Google bought AppSheet, the frequency of Community suggestions getting implemented was diminishing.  I have seen some smaller things, previously suggested, show up such as some of the expression assistance functions that have appeared over the past year. 

There are other no code/low code platforms.  Some do things better than AppSheet.  You just need to review any other platform to make sure it can deliver what you need before plunging in.  Building a small prototype app is the best way to analyze.


@kilowat wrote:

I am just curious why it is not possible to run apps scripts  directly from action.


Not directly but you can trigger a Bot with a button that then runs a script.  I'll assume you know that.  They could have allowed script configuration in the action but that would mean then that you have very similar configuration settings within the actions area as well as in the automation area.  I like what they have now as it keeps all automation in a common consistent place.  I frequent runs script via button as well as triggered by data changes.  I can use the same Bot for both.


@kilowat wrote:

Btw. Is there any page, which shows the roadmap of features planned to be added to appsheet?


No.  The closest we get are with Previews of new features. 

Another possibility is to use a bulk action.

1. Create a column in EVENTS to flag a row for copying

2. In EMPS, create an action to "Add a new row to another table using values from the childs rows from this row". The ref to EMP is the row id. Other values of the EVENT can be obtained by LOOKUP(TRUE, "EVENTS", "flag for copying", "target column").

Though the operation will take two steps (flag an EVENT row, choose emps and execute), you can use the EMPS' table view to filter employees for easier selection than using an ENUM dropdown list.

You can also implement various behavior conditions to ensure proper operation to avoid mistakes in case multiple users use the app.

Top Labels in this Space