GetQueryStringValue ( keyName ; sourceUrl )
Given a full URL and name of a key, returns the given key's value out of the entire URL.
Average rating: 4.4 (25 votes) Log in to vote
Cristos Lianides-Chin - Show more from this author
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
UPDATED 2014-09-03 with better version from commenter "unix" from Japan.
When given a full URL (including a querystring), and the name of a specific key in that querystring, this function will return the value associated with that key. Especially useful in conjunction with the GetLayoutObjectAttribute( "webviewerName" ; "Source" ) function, which can get the URL of a page to which the user has navigated.
Sep 2, 2014
~key = keyName ;
~url = sourceUrl ;
~params = Replace ( ~url ; 1 ; Position ( ~url & "?" ; "?" ; 1 ; 1 ) ; "" ) ; //get after "?"
~params = Left ( ~params ; Position ( ~params & "#" ; "#" ; 1 ; 1 ) - 1 ) ; //get before "#"
~params = Â¶ & Substitute ( ~params ; "&" ; Â¶ ) ; //separate key=value with Â¶
~pos = Position ( ~params ; Â¶ & ~key & "=" ; 1 ; 1 )
Case ( ~pos ; GetValue ( Substitute ( Replace ( ~params ; 1 ; ~pos ; "" ) ; "=" ; Â¶ ) ; 2 ) )
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.