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
Codence https://www.codence.com |
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.
Comments
unix, Japan Sep 2, 2014 |
||
Let ([ ~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.