Help

Re: How do I create a url with a formula?

12460 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Nathan_Cain
6 - Interface Innovator
6 - Interface Innovator

This is what I have tried: "http://nwatagalog.xyz/maps/"&pinColor&"/“number_”&sort&".png"

I’m getting this error:: “Sorry, there was a problem saving this column. Invalid formula. Please check your formula text.”

8 Replies 8
Nathan_Cain
6 - Interface Innovator
6 - Interface Innovator

Never mind. I see the problem. The formula should be: “http://nwatagalog.xyz/maps/"&pinColor&"/"&“number_”&sort&".png

JMichaelTX
5 - Automation Enthusiast
5 - Automation Enthusiast

For any other Airtable beginners like me, you create the URL using a Formula Field type.
Airtable then recognizes that it is a valid URL, and when you click on it, it opens the web page.

Fantastic!

Here’s my setup:

Formula:

("https://search.cdc.gov/search?query=%22" & SUBSTITUTE(Name, " ", "%20")) & "%22&utf8=%E2%9C%93&affiliate=cdc-main"

Keep in mind that you have properly encode the URL.
Here, I just substituted %22 for spaces.


Pasted image

Helmi
6 - Interface Innovator
6 - Interface Innovator

I just jump on here and add my question if it’s possible to add a name/title for this link so instead of the URL you can show a text that is linked.

Thank you @JMichaelTX !!! :raised_hands:

So far I’ve been asking users to manually URL encode their strings via http://www.url-encode-decode.com/

Using SUBSTITUTE(fieldName, " ", "%20") means I can streamline our URL builder tool - at least for simple single-line URL parameters.

Yihaaaa!

I’d like to see a URLENCODE(fieldName) function eventually.

Yes. Me too. I just want to see clickable text that opens the url if clicked.

Vernon_Fowler
7 - App Architect
7 - App Architect

For anyone seeing this, the ENCODE_URL_COMPONENT(component_string) function was added sometime over the last year. See it in the Formula field reference under Text functions.

Amos_Rendao
5 - Automation Enthusiast
5 - Automation Enthusiast

What the …?! Why am I doing anything with formulas when I just want to have my button field link out to another url. I shouldn’t have to do anything except copy / paste the url into where I want the button to go… :frowning:

escalateur
4 - Data Explorer
4 - Data Explorer

Solved: the expected input here is a string. Just put "quotemarks" around your URL and it should work. 

If your URL has multiple components (path equals another Airtable field, for instance), just use the formula CONCATENATE().

 

Example: 

CONCATENATE("https://api.whatsapp.com/send?phone=",{Contact phone})
 
Important: make sure the dynamic part of the formula (here {Contact phone}) doesn't have URL-breaking characteristics, like blank spaces. In this case I used a "short text" column instead of "phone number" so I have more freedom to remove spaces and "+" from the beginning. Another option might be to reformat the input directly in the Formula.