Brian Dunning's FileMaker Custom Functions

fmpGoogleMap ( address ; city ; state ; zip ; country )

Webviewer address display using Google Maps

  Average rating: 4.7 (22 votes) Log in to vote

Robert Jackson   Robert Jackson
RJ Plus Consulting
http://rjplusconsulting.tk

Share on Facebook Share on Twitter

  Sample input:
Let (

~address = Contacts::Work Address 1;
~city = Contacts::Work City;
~state = Contacts::Work State;
~zip = Contacts::Work Postal Code;
~country = Contacts::Work Country;
~result =
"https://www.google.com/maps/place/" & 
Case ( IsEmpty (~address) ; "" ; Substitute (~address;" ";"+") )& "+" &
Case ( IsEmpty (~city ); "" ; Substitute (~city;" ";"+") )& "+" & 
Case ( IsEmpty ( ~state) ; "" ; Substitute (~state;" ";"+") )& "+" & 
Case ( IsEmpty (~zip) ; "" ; Substitute (~zip;" ";"+") )& "+" & 
Case ( IsEmpty ( ~country) ; "" ; Substitute (~country; " " ; "+") )
];
~result
)
  Sample output:
https://www.google.com/maps/place/theAddress,+theCity,+theState+theZip,+theCountry

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

//  fmpGooglemap ( address ; city ; state ; zip ; country )

//  Aims:
//  display FileMaker address using Google Maps
//  avoid using Google API
//  avoid using iFrame
//  author Robert Jackson (Scotland)

Let (

~address = address;
~city = city;
~state = state;
~zip = zip;
~country = country;
~result =
"https://www.google.com/maps/place/" & 
Case ( IsEmpty (~address) ; "" ; Substitute (~address;" ";"+") ) & "+" &
Case ( IsEmpty (~city ); "" ; Substitute (~city;" ";"+") ) & "+" & 
Case ( IsEmpty ( ~state) ; "" ; Substitute (~state;" ";"+") ) & "+" & 
Case ( IsEmpty (~zip) ; "" ; Substitute (~zip;" ";"+") ) & "+" & 
Case ( IsEmpty ( ~country) ; "" ; Substitute (~country;"";"+" ) )
];
~result
)

 

 

Comments

Tim Anderson   Tim Anderson, Tim Anderson Group
Jun 12, 2015
Thanks Robert!
 
Robert Jackson   Robert Jackson, Scotland
Jun 12, 2015
tidied up code
 
comment   comment, VR
Jun 15, 2015
What is the difference between:

Case ( IsEmpty (~address) ; "" ; Substitute (~address;" ";"+") )

and:

Substitute (~address;" ";"+")
 
Vyke   Vyke, Washington DC
Jul 6, 2015
If you just do

Substitute(~address;" ";"+"), then, if the address is empty, you will get a +, which will screw up the calc.
 
Michael Leiser   Michael Leiser, BYA
Jun 15, 2023
Doesn't work. Shows the map for a second and then gives an error about updating my browsers. They are updated. This happened recently for any google map function. I even got an API but don't know where to use it.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: