Aug 26, 2020 01:11 PM
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!
Aug 26, 2020 01:45 PM
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.
Aug 26, 2020 01:50 PM
Hi @Justin_Barrett . Do you know if this can be achieved through Integromat?
Thanks for taking a look at my question!
Aug 26, 2020 01:58 PM
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).
Aug 26, 2020 02:13 PM
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}`})
}
}
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.
Aug 29, 2020 01:15 PM
Thank you for this! This is great!
Dec 02, 2022 02:46 AM
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})`})
}
}
Dec 05, 2022 03:05 AM
Can anyone tell me why it only works for some records but not all records? Thanks in advance.