2 Replies Latest reply on Aug 13, 2010 2:32 PM by basilisk2

    Can I link a field to internet data?

    basilisk2

      Title

      Can I link a field to internet data?

      Post

      Is it possible on FMP to link a field to data held on the internet? Eg, temperature from a weather website; share prices from an investment website; currency info from an FX site? I want the db field to automatically (if possible) update its value every time the file is opened.

      TIA

        • 1. Re: Can I link a field to internet data?
          FentonJones

          It is possible to "show" dynamic data from the Internet on a layout, using a Web Viewer. Which you could then "scrape" via a script, in order to set some particular data on the web page into a field(s). You can extract all the source code of the web page via:

          GetLayoutObjectAttribute ( "web viewer name"; "Content" )

          But there is an awful lot of text on a web page, and it is sometimes difficult to identify just the data you want using FileMaker text functions. Also, the web designer could change the page at any time.

          A better way to get info such as you want would be to use the Import XML command/script step to import only the pieces you want directly into fields. But this requires that the web site has an XML services output, which they allow you to target. 

          The XML returned is well-organized, and likely will seldom change its structure. But it is usually more data that you want. In any case, you'd have to write a custom XSL stylesheet for that specific xml, to transform it into xml which FileMaker can Import. 

          For example, this URL will return the weather as XML; from NOAA. It requires the "station code" for your local weather. Mine is "KSAN", Lindbergh Field (airport), San Diego.

          http://www.weather.gov/xml/current_obs/KSAN.xml

          This is an example, with the XSL stylesheet file required, which (currently) must remain in the same folder as the file to work (as it's a "relative" path; alternatively could be a URL path). It also includes an AppleScript script file. Which is what I use when developing, to get the XML returned as a file, so I can see it in order to create the XSL. It is almost impossible to build any kind of complex xml/xsl import using just FileMaker, as you cannot actually see the xml returned. But once you've written the XSL file, the FileMaker Import is only 1 step.

          Weather_xml.zip

          So, as you can see, the answer to your question is "yes, but it's a fair amount of work."

          • 2. Re: Can I link a field to internet data?
            basilisk2

            Thank you for taking the time to give me such a detailed explanation, which I appreciate. It is indeed a disappointment not to be able to link live to online data. OpenOffice can do this using its Data Source function, but of course that db is limited in other ways. I believe Numbers spreadsheet and Excel can also do this.