# Using AI to create an Input List for a repeating group

**URL:** <https://air.tableforums.com/t/using-ai-to-create-an-input-list-for-a-repeating-group/1281>\
**Category:** Airtable Questions\
**Created:** [August 13, 2024, 7:03pm UTC](https://air.tableforums.com/t/using-ai-to-create-an-input-list-for-a-repeating-group/1281 "2024-08-13T19:03:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![julian.post](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/julian.post/32/1032_2.png) [@julian.post](https://air.tableforums.com/u/julian.post)\
**Post date:** [August 13, 2024, 7:03pm UTC](https://air.tableforums.com/t/using-ai-to-create-an-input-list-for-a-repeating-group/1281/1 "2024-08-13T19:03:59Z")

</div>

I’m experimenting with using AI to extract structured data from a PDF document and create records from it. The example is a price list with 3 columns: Part number, description, price. I copy and paste the text into a long text field. An AI automation action can take that text and turn it into an array of values. I’d like to then use a repeating group to create a record for each of those Parts. What format is needed for Airtable to recognize the array as an input list?

---

<div class="post-metadata">

**Author:** ![ScottWorld](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/scottworld/32/5_2.png) [@ScottWorld](https://air.tableforums.com/u/ScottWorld)\
**Post date:** [August 14, 2024, 6:45am UTC](https://air.tableforums.com/t/using-ai-to-create-an-input-list-for-a-repeating-group/1281/2 "2024-08-14T06:45:50Z")

</div>

For the input list of a repeating group in an Airtable automation, Airtable only supports 4 types of inputs:

1. The result of the “Find Records” action.
2. A user field that is set to allow multiple users.
3. A linked record field that is set to allow multiple linked records.
4. Script output that is in an array format.

---

<div class="post-metadata">

**Author:** ![julian.post](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/julian.post/32/1032_2.png) [@julian.post](https://air.tableforums.com/u/julian.post)\
**Post date:** [August 15, 2024, 12:01am UTC](https://air.tableforums.com/t/using-ai-to-create-an-input-list-for-a-repeating-group/1281/3 "2024-08-15T00:01:01Z")

</div>

Thank you @ScottWorld! I suppose I can process the results through a script. Side note - I just learned recently that rollups can also be used as an input list

---

<div class="post-metadata">

**Author:** ![ScottWorld](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/scottworld/32/5_2.png) [@ScottWorld](https://air.tableforums.com/u/ScottWorld)\
**Post date:** [August 15, 2024, 6:12am UTC](https://air.tableforums.com/t/using-ai-to-create-an-input-list-for-a-repeating-group/1281/4 "2024-08-15T06:12:25Z")

</div>

Wow, rollups too? Thats good to know! Airtable should update their support article on this topic!

---

<div class="post-metadata">

**Author:** ![julian.post](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/julian.post/32/1032_2.png) [@julian.post](https://air.tableforums.com/u/julian.post)\
**Post date:** [August 15, 2024, 6:29pm UTC](https://air.tableforums.com/t/using-ai-to-create-an-input-list-for-a-repeating-group/1281/5 "2024-08-15T18:29:34Z")

</div>

They should! An update on my repeating group project: I was able to take JSON output from the AI action, use it as input for a script, then convert it to an array using JSON.parse()

From there, I was having an issue with Airtable recognizing the output when used as “current item” in a repeating group, getting an error message that said “Cannot assign union of object to collection of complex types”. Airtable support told me that this kind of error shows for an array of objects when a property can contain multiple data types. In my case, “Price” was usually a number but sometimes text. When I made sure it always output text, the repeating group worked.

The whole script looked like this:

```auto
const listOutput = input.config().list
const listPrices = JSON.parse(listOutput,
(key, value) =>
    typeof value === "number"
      ? "value" // return string value for numbers
      : value, // return everything else unchanged
);

output.set("List Prices", listPrices)

```

That said, it turned out that once the list was in a script, it was just as easy to create the repeating action with the script, and I made another version that did that instead - using the script to loop through records seemed to execute faster in this case. But it’s still nice to have the repeating groups as an option!

---

<div class="post-metadata">

**Author:** ![Kuovonne](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/kuovonne/32/17_2.png) [@Kuovonne](https://air.tableforums.com/u/Kuovonne)\
**Post date:** [August 16, 2024, 6:10pm UTC](https://air.tableforums.com/t/using-ai-to-create-an-input-list-for-a-repeating-group/1281/6 "2024-08-16T18:10:17Z")

</div>

> [@julian.post](#):
>
> rollups can also be used as an input list

Does it depend on the rollup formula? Sometimes rollup values are lists and sometimes they are not, depending on the formula. For example, I would expect `ARRAYCOMPACT(values)` to return a list, but I would expect `ARRAYJOIN(values)` to not be a list.

> [@julian.post](#):
>
> That said, it turned out that once the list was in a script, it was just as easy to create the repeating action with the script, and I made another version that did that instead - using the script to loop through records seemed to execute faster in this case. But it’s still nice to have the repeating groups as an option!

I find that updating records in a script is much faster than updating them in an update records action. However, I currently lean towards having the script output a list and then using a repeating action group with an update records action instead. Even though the execution time is slower and there are more actions in the automation, the overall system is less fragile: fewer hardcoded the field names or IDs in the script, and the automation shows up in the dependency checker.

---

<div class="post-metadata">

**Author:** ![julian.post](https://yyz1.discourse-cdn.com/flex029/user_avatar/air.tableforums.com/julian.post/32/1032_2.png) [@julian.post](https://air.tableforums.com/u/julian.post)\
**Post date:** [August 19, 2024, 2:27pm UTC](https://air.tableforums.com/t/using-ai-to-create-an-input-list-for-a-repeating-group/1281/7 "2024-08-19T14:27:39Z")

</div>

> [@Kuovonne](#):
>
> Does it depend on the rollup formula?

Probably it does. In the case that I saw, the fomula used was ARRAYUNIQUE(values)

> [@Kuovonne](#):
>
> the automation shows up in the dependency checker

This is a huge plus
