Creating multiple records based on a range of numbers


#1

I’ve been working on a base with multiple tables as well as using some Zapier integration. Without going into too much detail, I want to create records in a table with records from another table, but with some updates. The two most important fields is the “ID” field and the “Events” field. Basically, if a user enters an ID and 5 as the number of “events” into the previous table, another table would automatically update with ID appended with 1-5. So 5 records each appended with numbers 1 through 5. For example:

Table 1:
ID: 123
Events: 5

Table 2:
ID: 123.1
ID: 123.2
ID: 123.3
ID: 123.4
ID: 123.5
(5 Separate records)

Is there any way to do this with airtable and zapier? I have tried many different types of zaps and even some scripting but I can’t figure anything out. Thanks!


#2

If you can set a maximum number of events, it can be done in Airtable alone; alternatively, using the same base, a Zap can be configured to generate the records using standard Airtable functionality. (If you can’t predict the maximum number of events, you’ll have to go back to your original plan to have Zapier create each new record individually, as Airtable currently cannot handle open-ended loops.)

This base demonstrates the technique, allowing for automatic generation of up to 10 event records. The process is as shown in the following clip:

  1. The user enters an ID and the number of event records desired (from 1 to 10).
  2. The base creates a string of event IDs consisting of {ID} concatenated with '.' and the event number and separated by commas.
  3. The user copies the string of event IDs by selecting the field and pressing Ctrl-C. (Airtable doesn’t support explicit, mouse-driven copies of an entire field, but that’s what’s going on in that section of the video.)
  4. The user pastes the Event ID string into the linked-record field pointing at the [Events] table by selecting the field and pressing Ctrl-V. (Ditto.)
  5. Airtable generates a new [Events] record for each ID in the string.

The copy/paste routine can be automated using Zapier. The demo base contains a view entitled <New Event IDs> that can be used to trigger a ‘New record in view’ Zap that updates the triggering record by saving the contents of {Event IDs} to {Link2Events}.

If for some reason you can’t have the events linked to the related {ID}, this method won’t work for you — but given your event naming convention, I suspect that’s not the case…


Onboarding Process
#3

Wow this is perfect! Thank you so much


#4

Also, if you could share the formula with me it would be greatly appreciated!


#5

Oh, sorry: Use the provided read-only link to access the base. From there, click on the drop-down beside the base heading and choose ‘duplicate base’. Once a copy is in your own workspace, you’ll be able to see and edit formula fields. (I use shared read-only links and personal copies to keep from stepping on anyone else’s code and data and to make sure I’m not billed for several hundred collaborators each month! :wink: )