Got it! Thank you for that clarity.
Cool use case too of making a lottery app!
I'll start by noting that you cannot specify a loop that way in Honeycode (specifying how many times it runs from a user input), because the iterators in Honeycode instead loop over existing data to evaluate if an automation step will run again. This is a good use case though that I could file an improvement request for.
However, you can achieve what you're asking for if you have a defined number of ticket sets a user could select. For example, you could have a dropdown that a user selects the number of sets they would like. You can then have an automation with action steps that each write a new row for the defined amount.
This is the example app I built to show you this:
This is the form in app:
And the list in app:
I have a rowlink field (dropdown) for how many lottery ticket sets the user would like. I did up to 5 sets for this example:
Setting up the field in Builder:
This is the table I created to have a defined amount of sets:
And the dropdown in the app:
In Tables, I made a separate table with columns for the contact name, ticket set number, and for each lottery number for the set. I put in the desired default start data for the entries to count off from:
In Builder, on the Submit button, I created an automation with an "Add a row" action that uses the MAX() function increment the lottery number by 1 from the last entry (similar to how you did).
So in my example, the first action adds a row and updates all the columns. It starts with just numbering this as set "1":
And I update each column of the lottery numbers using the MAX() function.
Example formula I used:
Then in the same automation, you can add more actions for each of the additional sets (Select the "Add a row" action again). In the run options for each of these successive steps, you would define the step to run only if the value is equal to or less than the specified amount of tickets. So for example, for the second set of tickets you would write the following in the run options:
And you can define it as the second set like this:
Then add the same column updates as in the previous step, using the MAX() function.
And for the third set of tickets, add another action that is set up similarly. And so on for each of the following sets.
And now when a user selects a number of sets, it will write the specified number of rows and increment the value of each lottery ticket by one:
In a list in the app:
I hope this example helps! The key is having a defined number of sets a user can select.
However, I'll still pass on the improvement request to our team, of being able to input a number to specify how many times an automation may run (as noted above in my reply).
Let us know if you have any further thoughts or questions on this.