Jul 19, 2024 11:30 AM
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?
Solved! Go to Solution.
Jul 19, 2024 10:29 PM
Hmm, when I do a getCellValue on rollup fields that are rolling up linked records or text, this is my output:
let rollupLinkedField = record.getCellValue("Dependencies (from Table 2)")
console.log(rollupLinkedField)
let rollupTextField = record.getCellValue('Name (from Gantt)')
console.log(rollupTextField)
Jul 19, 2024 10:29 PM
Hmm, when I do a getCellValue on rollup fields that are rolling up linked records or text, this is my output:
let rollupLinkedField = record.getCellValue("Dependencies (from Table 2)")
console.log(rollupLinkedField)
let rollupTextField = record.getCellValue('Name (from Gantt)')
console.log(rollupTextField)
Jul 29, 2024 02:20 PM
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.