Duplicate / insert row n times

Hi all

I have a table from airtable that I need to expand in the following way please.

I have a table that contains orders for hand made beanies that has a sku and a quantity.

SKU. QTY
ABC. 3
ABD. 2
DEF. 1

I need to create / update another table in the following way.

SKU. Allocated To
ABC
ABC
ABC
ABD
ABD
DEF

In essence duplicating the Sku’s for as many as needed in the QTY column. The source data may change and more qty added or removed so the new table needs to be able to reflect this.

This is because each is beanie is made by an individual maker and needs to be assigned to them.

This table is then printed out and filled in manually and then ultimately added back to airtable.

I’d like to do this in parabola if possible as it needs to be pushed to a few different places.

Thanks!

Jonathan

Hey Jonathan,

This was a fun (albeit confusing) one to figure out. This should work as long as you have an upper bound on how large your quantity field will be, and that upper bound is small enough that you can manually configure the Parabola flow for the first run. I’d definitely consider this solution a bit fragile, but within those constraints it should be fine.

This flow solves your current sample data and can handle quantities up to 4. To handle larger quantities, you’d need to add more “Insert math column” and “Insert if/else column” steps.

You can try it for yourself by copying and pasting this snippet onto your canvas: parabola:cb:a83c6d8a32ee4e098e3ddac9fdc2c374

Let me know if that helps!
Alex

3 Likes

Hi Alex,

We have similar situation where we need to duplicate SKU based on QTY column. Right now we’re doing that using a Excel VBA macro, and it has to run multiple times per day to process multiple files, and it’s part of pre-processing for other steps. We would love to be able to use Parabola to automate that function. Tried your snippet, and it won’t work for us, as the values in QTY can be large. It would be great if there is some kind of ‘duplicate row’ transform function and some For-Next loop function.

Hi @RB,

What is the approximate range of quantities that you’re working with per line item? If you can define that upper bound once, it should be able to transform nearly all future quantities into separate rows.

Completely agree though – having those functions would be extremely helpful for duplicating rows based on quantities.

If you’re able to, could you post this in the #feature-requests section of our community forum? It would be great to bring more visibility to this request by allowing other members to chime in!