Skip to main content

Combining mutliple rows of records into one entry

  • March 30, 2022
  • 4 replies
  • 175 views

I use a service that exports a list of movies. Whenever there are multiple countries or directors it puts them into a new row below the main record. Is there any way to combine these additional rows of entries automatically so they all go into the same row as the movie title?

Here’s the airtable in question:

4 replies

Forum|alt.badge.img+16
  • Inspiring
  • 529 replies
  • March 30, 2022

Are you importing a CSV or Excel file?


  • Author
  • New Participant
  • 1 reply
  • March 30, 2022

Are you importing a CSV or Excel file?


I’ve been importing a CSV file but imagine I could do in a different format. Why?


Forum|alt.badge.img+16
  • Inspiring
  • 529 replies
  • March 30, 2022

I’ve been importing a CSV file but imagine I could do in a different format. Why?


It may be easier to clean up the CSV file before importing so that multiple director or country are on the same row in the CSV, it looks like they are on separate rows in the CSV file.


Alexey_Gusev
Forum|alt.badge.img+25
  • Brainy
  • 1261 replies
  • March 31, 2022

Hi,

single time solution
add ‘t2’ column next to ‘title’ and use this script to fill it.


const table=base.getTable('Imported table');
const query=await table.selectRecordsAsync({fields:['title','t2']})
let movieName='initialValue'; 
const getName=rec=>(movieName=rec.getCellValue('title')?  rec.getCellValue('title') : movieName )
const update=(el)=>({'id':el.id,'fields':{'t2':getName(el)}})
const upd=query.records.map(update);
while (upd.length) await table.updateRecordsAsync(upd.splice(0,50))

then create third empty table ‘grouped’
in ‘Imported table’, near ‘t2’ create linked field (to ‘grouped’)
copy-paste t2 into it

turn to ‘grouped’ and get your data via lookups
then convert these lookups to your desired type and name