Help

Re: Creating new entries from a long text field

Solved
Jump to Solution
5254 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Hidro01
6 - Interface Innovator
6 - Interface Innovator

Continuing the discussion from Creating new row entries from a long text:

Since this thread was closed and I’m facing a similar problem I was wondering if someone could help out.

I have a Long text field in my table, lets call it “Task Submission”, that I would like to create entries in another table from each new line of text, as shown in the image below.

image

Is there a Way to script this to run manually or automatically. I have an enterprise plan.

I need this because i need users to submit new tasks that need to be followed in another table.

thanks

1 Solution

Accepted Solutions
Alexey_Gusev
13 - Mars
13 - Mars

Hi,
change table1,2 and pri2,lnk2 names

const table=base.getTable('totals1')
const table2=base.getTable('totals2')
const query=await table.selectRecordsAsync({fields:['Task Submission']})
const arr=text=>text? text.split('"').join('').split(`\n`):[]
const newrow=r=>arr(r.getCellValue('Task Submission')).map(ln=>({fields:{'pri2':ln,'lnk2':[{id:r.id}]}}))
const crt=query.records.flatMap(newrow)
while (crt.length) await table2.createRecordsAsync(crt.splice(0,50))

See Solution in Thread

14 Replies 14

Are the task names known? Is there a maximum amount of tasks that can be entered?

It’s definitely possible to have some javascript code parse over the text field and transcribe returns into a linked field - the tricky part will be knowing what triggers words and numbers within the text field to be a task, and what separates one task from the next.

Hidro01
6 - Interface Innovator
6 - Interface Innovator

The tasks are coming via a form submission, so they can be anything .
There is no Maximum but I don-t expect anything above 10.

Ideally, the script would be triggered via form submission or to run every day.

I’m sure this would be an easy task for someone with java script knowledge :slightly_smiling_face:

Hidro01
6 - Interface Innovator
6 - Interface Innovator

I think What I would like to do is similar to this:

Linking Existing Records Using Automations | Airtable Support

Except I would like to create the new records (tasks) from an existing field. So each task is unique for each project

Alexey_Gusev
13 - Mars
13 - Mars

Hi,
change table1,2 and pri2,lnk2 names

const table=base.getTable('totals1')
const table2=base.getTable('totals2')
const query=await table.selectRecordsAsync({fields:['Task Submission']})
const arr=text=>text? text.split('"').join('').split(`\n`):[]
const newrow=r=>arr(r.getCellValue('Task Submission')).map(ln=>({fields:{'pri2':ln,'lnk2':[{id:r.id}]}}))
const crt=query.records.flatMap(newrow)
while (crt.length) await table2.createRecordsAsync(crt.splice(0,50))
Hidro01
6 - Interface Innovator
6 - Interface Innovator

Many thanks I will try it. just to be sure I got it…

I am guessing

“totals1” is the originator table with the “Task Submission” field from which lines will be converted to entries in the “totals2” table?

So I guess one of the “pri2” or the “link2” is the field in the destination table “totals2”, right? So what is the other one?

Maybe you copied this from another example and i am just a bit confused…
Thanks for clarifying
Thanks

Hi,
nope, I’ve created it, just forget to rename tables. Pri and Lnk are primary and link fields of destination table.

Hidro01
6 - Interface Innovator
6 - Interface Innovator

Thanks
FYI I found a work around that requires the use of automation and regex formula field. I will post it later

Hey, can you post the workaround that you utilized? I have a similar problem to address.

Hidro01
6 - Interface Innovator
6 - Interface Innovator

Yes, let me post the complete workaround in a while. But I can tell you it involves the Regex formula and an Automation