Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

Combining Text Column & URL Column to create Text with Hyperlink inline

3932 7
cancel
Showing results for 
Search instead for 
Did you mean: 

Hi! I have the following set up:

Column A: Name
Column B: Text
Column C: URL

I would like to combine these into a new column to read like so:

“Text (with hyperlink) - Name”

I should note that the URL is to an external page, and not an internal reference to another base / table / etc. Any idea how to help with this? Thanks!

7 Replies 7

Welcome to the community, @Steve_Marks1! :grinning_face_with_big_eyes: That kind of hyperlink can’t be created via formula at this time. You can manually create something like that in a long text field with rich text enabled, but formulas can’t currently create rich text. I haven’t yet tried creating such rich hyperlinks via scripts, though, but I might play around a bit. If I do, I’ll let you know how it turns out.

Hi @Justin_Barrett . Do you know if this can be achieved through Integromat?

Thanks for taking a look at my question!

Possibly. I ran a really brief test a while ago (shortly after rich text was added to Airtable) creating rich text via Integromat, and it worked. You just need to follow the markdown syntax as outlined in the docs. My gut says that if it works from Integromat, it would probably also work internally using a script (either the Scripting block, or an automation).

Just ran a quick test with the scripting block, and it works. Here’s my test script:

let tb = base.getTable("URL Test");
let query = await tb.selectRecordsAsync();
for (let record of query.records) {
    let url = record.getCellValue("URL");
    let name = record.name;
    let text = record.getCellValue("Text");
    if(url) {
        tb.updateRecordAsync(record, {"Rich": `[${text}](${url}) - ${name}`})
    }
}

Screen Shot 2020-08-26 at 2.12.09 PM

This will only make the hyperlink when there’s a URL in the {URL} field. With a little more twiddling, this could be modified to work via Airtable’s automation system, to automatically create the hyperlink as the record is being edited.

Thank you for this! This is great!

I'm trying to do something similar, but getting some odd results — and not all of the records are being processed — with other scripting blocks I've seen, I can recall sometimes there is a need to slice the records 50 at a time?

What am I missing here?

// Combine Twitter Handles with URLs to make richtext links
let tb = base.getTable("People");
let query = await tb.selectRecordsAsync();
for (let record of query.records) {
let handle = record.getCellValue("Twitter Handle");
if(handle) {
tb.updateRecordAsync(record, {"Twitter Link": `[${handle}](https://twitter.com/${handle})`})
}
}

Can anyone tell me why it only works for some records but not all records? Thanks in advance.