UTM Builder If Blank Formula

Topic Labels: Formulas
904 1
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

I am building a UTM builder in airtable. Everything is working except there is one field where we do not always need a value. when I leave it blank the end of my URL has “_content=”. I’d like to have a formula that removes that last part of the URL when that value is not present. Does anyone know how to program that?

1 Reply 1

Welcome to the community, @Megan_Kenley! :grinning_face_with_big_eyes: Instead of removing it after it’s added, I suggest modifying the system you’re using to build the URL so that the optional piece is never added if that related field is empty. That can be done with a simple IF() function around that part, like the example below. This is just the end of a longer formula, and I’m using the field name {Content} to represent your optional content field. I’m also wrapping the contents of the {Content} field in the ENCODE_URL_COMPONENT() function, as all content passed via URL should be encoded:

... & IF(Content, "&content=" & ENCODE_URL_COMPONENT(Content))