Creating a certain number of rows based on a user provided bound

Hello Gliders,
I am building an app for a farm which has several planting rows (A,B,C…) and beds within rows (1,2,3). There is a screen where farmer would input:
Row - A
No. of Beds - 15
I want to use these two pieces of info (A and 15) to auto-populate a sheet with a row and bed combination so it looks like this:
A1
A2
A3
A4

A15.
Obbiously the same thing would repeat for rows B and onwards based on however many combinations of rows and beds the farm has.

How do I do this? Thanks much!

First thought is do you really need a new spreadsheet row for each row/bed combo? Could you perhaps have all the beds for each row, be in one spreadsheet row? If there’s not much data specific to each bed, perhaps you could do bed data as repeated columns. Such as your spread sheet columns being such as:

Row | Bed 1 plant type | Bed 1 seeded date | Bed 1 other info | Bed 2 plant type | Bed 2 seeded date | Bed 2 other info | Bed 3…

This would be a better way to handle the data with fewer rows and update cost, if it’s possible for you.

To do directly what you’re asking, adding a bunch of spreadsheet rows from inputting number of beds for that row… I think you have a few options, none of which super simple. Could use Make (formerly Intergromat), or a custom action that adds each row. Your action as far as I know how to build it, would be a little tedious to build if it’s to allow a large number of beds.

Here’s a screen to add… just put row letter, and number of beds.

You’d have this create data, where the user specific columns take the input, and create template columns for each row-bed index (I only went up to 4… you’d need to go up to however many is allowed.)

The basic action would look like this… but, you need some control over how many rows are added.

The nicer for user setup would be to create a bunch of conditions, to know how many rows to add.

Alternatively you could put wait conditions with very short wait periods, to break the action when you get to the right number added. This would result in a red notification presented to the user… but you can make it say “complete” rather than error, so it looks alright.

I think that gives you a few options to do what you want… though I’d really push for the first option of just added all the data for multiple beds into the same row of data, if that’s possible. It’ll reduce the cost of the app significantly in terms of updates and row usage.

Hope that helps!

I think you could do that with a helper table where the number of rows in your helper table is equal to the maximum number of beds you could have.

Hard code a column with the bed number and template it together with the Row Choice. Finally use an if then else column to show the template column if less than or equal to maximum bed number

2 Likes

Thankyou for the detailed explanation. I am going to try it out.

I was hoping the row and bed numbers would be dynamic. For this solution to work I would need to know the number of rows at each farm. Was hoping it could be handled at the user level. Anyways will try both approaches suggested. Thanks @Eric_Penn and @MatthewS

1 Like

My solution for How to make loops of rows and repeat them dynamic number of times could work here but it’ll be tricky if you want to be able to write addl metadata into those rows and delete rows it later :thinking::thinking::thinking: