Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Sep 09, 2024 11:05 AM
I'm using an Automation to create records for Parent Contract data to be pumped out of Airtable using Zapier. Tables with source data:
Relationships:
I have an automation successfully running for cases where the family has 1 student enrolled in 1 class - the family, student and class data is successfully written into the Contracts table. I use Find Records to generate a list of Classes - when the Length = 1 all's good. Trying to figure out how to handle multiple classes per student (Length > 1), and eventually multiple students per family (each of who may have > 1 class). The Contracts table has separate fields for all data up to 4 classes (e.g., class name, teacher name, tuition, etc.) and so the list data needs to be written to the correct field (e.g., List item #1 goes to the set of fields labeled Class1; List item #2 goes to the set of fields labeled Class2, etc.)
There is no Automation Action for Parse Data, so I guess the solution is to use a Script (which I'm not really familiar with, but could pick up quickly) - OR to use Zaper to parse the data and update the record back in Airtable - which I'd rather not do and keep all data manipulation within Airtable - but not a requirement.
Can anyone help? Thanks.
Sep 10, 2024 10:33 AM
As far as I'm aware, your guess is correct: you need to do this with a script.
I have a few bases running similar automations (make many records out of one) and I've always had to write a script for it.
Let me know if you find another way!
Sep 10, 2024 11:38 AM
Thanks - would you be willing to share a simple script to do this? I understand basic scripting principles and could likely follow.
Sep 10, 2024 12:47 PM
The scripts are highly tailored to your base design. There's really no "simple" mode that translates across bases.
Here's the basic process though (you probably already worked this out yourself):
-Load the record you are splitting into multiple records
-Parse the data and assemble an array of objects where each object has the information for the new records you want to create
-Create the new records using the createRecordsAsync function
I could share some more specifics through a private message if you'd like, I'd prefer not to post them publicly as they were written for private clients.
Sep 12, 2024 06:45 AM
Thanks - I'll send you a private message with more details. Appreciate the help.