Looping Action

I need to perform iterate / loop records and select records based that match specific logic / condition. Please implement an appropriate action / function.

0 19 2,191
19 REPLIES 19

Steve
Platinum 4
Platinum 4

Already exists:

(See the second option)
2X_f_f64f6ce74d327d417858f1dd24760d25f28c458d.png

I want to add 200 new records in one go.
How I can do so without some while() or loo() function?

Is this possible? What if I had a 400 row table, and 20 of them had the same column A value, and 40 of the next rows had the same column value. Is it possible to submit a form with an enumeration of the column A values, and then add the first 20 rows to the end of the table, but being able to change the column A value and column B value when added to the end of the table?

@retailpartnercom what are you asking hereโ€ฆ I feel like thereโ€™s a good answer just around the corner, I just canโ€™t quite put my finger on what youโ€™re asking.

Please, share some working app

@Steve I have implemented the loop feature outlined in your post using Actions, but as you say:

make no mistake: this is an advanced technique.

I am now working on a new module where I have to repeat these steps to offer the same functionality of maintaining a many-to-many relationship between Product and Control. Now that the new Automation feature is up-and-running, I was hoping to use this implementation going forward.

However from other posts: Looping over several rows it appears the Automation approach generates errors.

If it is possible to use Automation for looping, can an updated Looping example using this technique be provided?

I have no experience with Automation and have no intentions to adapt my process to Automation in the foreseeable future. Automation is too new and unstable for my tastes; and my process works entirely client-side, where Automation does not.

My sentiments exactly

Best
Matt

Hi @Steve I appreciate your sentiments. My use-case actually requires a server-side solution, becausing creating a few hundred - 1,000 new product group members on the client-side, simply takes too long. The SAVE product group event, which triggers the product group-member update freezes while this process is in progress.

Unfortunately AppSheet have disabled the add a new Workflow function, so I cannot even try that route and the Bot function is an unknownโ€ฆand proving awkward to implement.

This is all part of maintaining a many-to-many relationship using an intermediary table.

Hi Steve,
Is there any issue / disagreement upon implementation of while() , Loop function and add n number of rows to a table ?
Even FileMaker Pro (Joint Low Code Leader from Apple) took years to listen and implement While function. It simplifies some of the tasks in an incredible manner. FileMaker Pro provides Loop script step as well.

Hey @Riazsg, could you elaborate on a scenario that you would need a WHILE() function for? Iโ€™ve been wracking my brain trying to come up with a scenario, but everything I come up with already fits into the actions available.

Perhaps itโ€™s just a matter of finding the right technique for accomplishing what you want to do.

Hi
Let us begin with a simple scenario.

  1. I have a Google Sheet โ€œCustomersโ€ with no data.
  2. I created a new app in appsheet โ€œCustomersโ€
  3. Added a new table โ€œCustomersโ€ with only column names without any data.
  4. Now I want to create an action to add a variable number of records with prefilled data to the Customers table. I have many customers. So each customer will have different number of records to be added. I want to be able to pass the number of records to be created as a parameter to the action. Otherwise I will be create multiple action which is really unnecessary and cumbersome.

I will appreciate your help



Hello @Riazsg;

In order to accomplish this, you first need to have the information about how many customer records to create for each customer ALREADY present in the app.

I see the confusion and difficulty with your scenario.

You might be better served by looking into the Import CSV feature - this would allow you to pre-formulate certain parts of your table, and use formulas for the rest, to automaticaly populate your customers table with records.


If you wanted to create a way to create customer records inside the app, like I said before you need a list of records that need to be created ALREADY present in the app.

Imagine if you will:

  • you have a table that contains a list of customer names/emails/phone numbers to be added to the customer table.

(Would this NOT be your customer table already???)

If you wanted to use this list as the bases for creating customer records, you would first need to add that first table to the app - this way the data about what needs to be created is present and in the system.

You canโ€™t expect a data system to create data when youโ€™re not telling it what to create.

  • From here, youโ€™d use that list in your action (creating records in another table using values from the table) as the basis for what records to create.
  • To ensure you donโ€™t get duplicates, youโ€™ll need to put a condition on the action (taking your reference list of customers and subtracting the created list of customers - giving you the difference in records that need to be created; if the difference is NOT blank, then the action will run).

Can I specify the number of records to be created as a dynamic parameter and not as a static value that needs to changed manually each time?

Of course, instead of using a number use a formula to derive that number. Thatโ€™s what I meant by:

But in order for that to work, you need to have the data present inside the app to tell it how many need to be created, how many are already created, etc.

I suggested this new feature some time ago. Consider adding your vote and comments there please:

Top Labels in this Space