Help

Re: Hyperlinking - This should be easy.

517 0
cancel
Showing results for 
Search instead for 
Did you mean: 
elasticp
4 - Data Explorer
4 - Data Explorer

If anyone could shed light on this I would be appreciative. 

In my example, I have two columns, one with a ResourceName, the other a URL. A third column would hyperlink the ResourceName with the URL. Easy peasy? Not so. Still. 

A: ResourceName    Brown Cow
B: URL                        https://browncow.com
C: Resource              Brown Cow

I tried this script from another thread but, line 2, let query = await table.selectRecordsAsync (); function is deprecated. It does work... for 15 rows but, stops there, and no matter what I try, 15 is all I can get. 

 

 

let tb = base.getTable("My Resources");
let query = await tb.selectRecordsAsync(); 
for (let record of query.records) {
    let url = record.getCellValue("URL");
    let text = record.getCellValue("ResourceName");
    if(url) {
        tb.updateRecordAsync(record, {"Resource": `[${text}](${url})`})
    }
}

 

I've returned to Airtable a few times in the past several years and have long been perplexed why it does not allow one of the most basic functions of the internet to be used easily. That is, hyperlinking a long-text field with a URL via a script.

Thanks!

1 Reply 1
TheTimeSavingCo
18 - Pluto
18 - Pluto

Try using updateRecordsAsync instead:

Screen Recording 2024-02-15 at 10.20.20 AM.gif

 

let tb = base.getTable("My Resources");
let query = await tb.selectRecordsAsync(); 

let updates = []

for (let record of query.records) {
    let url = record.getCellValue("URL");
    let text = record.getCellValue("ResourceName");
    if(url) {
        updates.push({
            id: record.id,
            fields:{
                'Resource': `[${text}](${url})`
            }
        })
    }
}


while (updates.length > 0) {
    await tb.updateRecordsAsync(updates.slice(0, 50));
    updates = updates.slice(50);
}