Help

Rollup fields - an array of multiple items, or just a string?

Topic Labels: Data
Solved
Jump to Solution
359 2
cancel
Showing results for 
Search instead for 
Did you mean: 
cgreaves
5 - Automation Enthusiast
5 - Automation Enthusiast

I'm creating a script to compare two rollup fields and add the values both share into a third column. The fields roll up linked record fields and return them as just the text in a comma-separated list. Airtable documentation says rollup fields are an array; it looks like this is technically true, but it seems to be an array of a single string. When I log.console the cell value (note, I'm using getCellValue, not getCellValueAsString), I get ["Category 1, Category 2, Category 3"]. I want to get an array of multiple strings: ["Category 1", "Category 2", "Category 3"]. I'm very new to Airtable, so before I try to figure out ways within my script to separate the one string using the commas and all that, I want to make ask:

1. Is this single string output the expected behavior, or is my script calling it incorrectly?

2. If it's normal, is there way to configure the rollup fields to instead keep them as separate items?

1 Solution

Accepted Solutions
TheTimeSavingCo
18 - Pluto
18 - Pluto

Hmm, when I do a getCellValue on rollup fields that are rolling up linked records or text, this is my output:

Screenshot 2024-07-20 at 1.28.58 PM.png

Screenshot 2024-07-20 at 1.29.05 PM.png

let rollupLinkedField = record.getCellValue("Dependencies (from Table 2)")
console.log(rollupLinkedField)

let rollupTextField = record.getCellValue('Name (from Gantt)')
console.log(rollupTextField)

 

See Solution in Thread

2 Replies 2
TheTimeSavingCo
18 - Pluto
18 - Pluto

Hmm, when I do a getCellValue on rollup fields that are rolling up linked records or text, this is my output:

Screenshot 2024-07-20 at 1.28.58 PM.png

Screenshot 2024-07-20 at 1.29.05 PM.png

let rollupLinkedField = record.getCellValue("Dependencies (from Table 2)")
console.log(rollupLinkedField)

let rollupTextField = record.getCellValue('Name (from Gantt)')
console.log(rollupTextField)

 

cgreaves
5 - Automation Enthusiast
5 - Automation Enthusiast

I rewrote my code at some point and the issue stopped. I can only assume I was implementing in a weird way somewhere that wouldn't come up when following more common practices. Thanks for your insight.