Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Webviewer grabbing mileage info from mapquest

Featured Replies

I want to have a webview that uses either mapquest or google maps that shows the mileage between two locations, based on "To" & "From" fields in Filemaker. I'm having trouble figuring out how the syntax works.  I do have on another layout with a webviewer that interacts with a website and information is fed to & from filemaker so I know it's possible.

 

To sum it up, I want mapquest via filemaker to take the city, state from & to and feed me back the mileage.

 

Any help or guidance would be greatly appreciated!

 

Thank you,

 

Caroline

I'm not sure about MapQuest.  I've never tried to use it.  I assume you're actually trying to insert mileage into a field.  If so, you can use GoogleMaps API to return either a JSON or XML string and parse the string for the distance.  I've only ever attempted parsing XML with custom functions.  The custom functions I use came from one of the starter solutions that come with FM12.

 

The distance is returned as an element called "distance".  It has two child elements called "text" and "value".  The "text" comes back as "XX.X mi".  The "value" comes back as an integer in meters.  I would grab this and then convert it to miles (or whatever you want).

 

This is the format for the url you would use:

 

"http://maps.googleapis.com/maps/api/directions/xml?origin=" & TableName::FromField & "&destination=" & TableName::ToField & "&sensor=false"

 

Just feed your "From" field in as the "origin=" parameter and your "To" field as the "destination=" parameter.  

Click HERE to see an example of the results you would get back if you used San Antonio as an origin and Austin as the destination.

 

If you have FM12, it can be done via scripting with a global field and the "Insert From URL" script step.  

 

If you're running a prior version, then you'll have to use a web viewer and parse the results out of that.

 

It's a bit complicated, but it can be done.

  • Author

Thank you so much for your reply. They are not using Filemaker 12 as of yet (11). So I put a web viewer on the layout that automatcially display the current origin , destination from the current filemaker record. And at times it's a multicity route. This is working for now. As they move from record to record (in this case loads, it's a logistics company) it displays the results. Also they can view the directions right there. It Can however be a tad slow at times. I might try doing it as you suggested.

Hi,

I would like to use this method for a client. Do you know of a way to get the XML text out of the Web Viewer and into an FM text field for parsing in FM 11 using a script? All I can get is the ridiculous mess of HTML using GetLayoutObjectAttribute.

 

Thanks for the tip!

@daveinc
I'm not sure exactly what you are trying to do, but if you look at some of the custom functions available on  Brian Dunning's website, or on the Filemaker Custom Functions  website and search under HTML or XML, you should find something to help.

Brian

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.