Monday, November 2, 2009

URL Encode Calculation / Function for FileMaker Pro

This function is for when you send field data to a website with the "Open URL" Script Step, or if you're storing url encoded links.

Substitute (
INSERT FIELD NAME HERE
; ["¶" ; "%0D"]
; ["%" ; "%25"]
;[ "#" ; "%23"]
;[ "`" ; "%91"]
;[ "~" ; "%7E"]
;[ "!" ; "%21"]
;[ "@" ; "%40"]
;[ "$" ; "%24"]
;[ "^" ; "%5E"]
;[ "*" ; "%2A"]
;[ "(" ; "%28"]
;[ ")" ; "%29"]
;[ "-" ; "%2D"]
;[ "_" ; "%5F"]
;[ "=" ; "%3D"]
;[ "+" ; "%2B"]
;[ "" ; "%3A"]
;["\\" ; "%5C"]
;[ "]" ; "%5D"]
;[ "[" ; "%5B"]
;["{" ; "%7B"]
;[ "}" ; "%7D"]
;[ ";" ; "%3B"]
;[ ":" ; "%3A"]
;[ "'" ; "%27"]
;[ "\"" ; "%22"]
;[ "<" ; "%3C"]
;[ ">" ; "%3E"]
;[ "," ; "%2C"]
;[ "." ; "%2E"]
;[ "/" ; "%2F"]
;[ "?" ; "%3F"]
;[ "&" ; "%26"])

Now, I created this function about a year or two ago on my own, but out of curiosity, I just did a google search for "urlencode filemaker" and found an incredibly similar function on Brian Cummings FileMaker Pro Custom Functions page. So, out of fairness, I'll give him credit for his or his team's work,
but I swear I couldn't find his page when I made the calculation. However, my function does have a few more encoded characters.

Anyway, hopefully this will help anyone else out there looking for such a function.