Mar 30, 2022 11:01 AM
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:
Mar 30, 2022 12:57 PM
Are you importing a CSV or Excel file?
Mar 30, 2022 01:21 PM
I’ve been importing a CSV file but imagine I could do in a different format. Why?
Mar 30, 2022 01:26 PM
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.
Mar 30, 2022 09:40 PM
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