Airtable Cobuilder is here! Learn more about our new no-code app creation feature, powered by AI on the Airtable Academy

Create multiple records in a based on number of fields with value > 0 in a second table

Topic Labels: Automations
1017 0
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

Here's the challenge I need to find a solution for. 

I have a table of "Orders" placed by Girl Scouts in my troop. Their orders are for Girl Scout cookies they've sold.

There are 9 possible cookies someone can order, and there's a number column for each cookie that contains how many packages they are ordering.

Say an order comes for 3 Adventurefuls, 0 Lemonups, 4 Trefoils, and 10 Thin Mints, and 0 of the remaining cookies Do-Si-Dos, Samoas, Tagalongs, Toffeetastics, and smores.  I need to create a record in another table, called Order Lines, for EACH cookie they ordered. In this case, I'd need 3 new records in the Order Lines table: 

Order Line 1: Adventurefuls, quantity 3

Order Line 2: Trefoils, qty 4

Order Line 3: Thin Mints, qty 10

How do I create an automation that will create as many order line records as I have cookies ordered? Looping could work if I knew how to create a list of the cookies where quantity >0 and their quantities, but I'm not sure how to do that. 

Thanks so much. 

0 Replies 0