2 Replies Latest reply on Dec 25, 2014 6:57 PM by FentonJones

    Pulling data from website



      Pulling data from website


      I am new to Filemaker but loving it. I am starting a new project with it for inventory purposes. A key part of this project is to be able to pull quantity of products off a website and enter that data onto my Filemaker solution. The same website will be used as a source. For example; I open my Filemaker solution and it shows that there are 4 green widgets, 2 blue widgets and 5 orange widgets in stock from the website.

      What is the easiest way to do this? Is there a script available to do this? Any information would be appreciated. 

        • 1. Re: Pulling data from website

          It might be possible to do this via Insert from URL. GetLayoutObjectAttribute is another option that can "scrape" data from a web site, but you have set up calculations to parse the downloaded data into individual fields and records.

          • 2. Re: Pulling data from website

            Another possibility, in you're on a Mac, would be to use the Perform AppleScript script step, to run an AppleScript (AS) to get the web site (URL) as text (like what you see on the page). This is often much less text than the raw HTML text. 

            There is also an Import using XML (with an XSL also); which can be the best way, if the web site allows such an "export from them, as XML (text)".

            If you use the text via AS, it would also be possible to do the parsing via its possible command line methods, which could also allow using tools from Unix (which is very geeks, and tricky, but quite powerful on text). 

            Several possible methods; often, unfortunately, none of which is "easy to parse the web site", to get the data you need. 

            This is the Perform AppleScript (entered as text). It has one FileMaker field, named "Text_", which also must be enterable on the current layout; you can name as whatever your field is named, instead. It also assumes that you want the current web page on "window 1" of the "Safari" application.

            tell current record of document 1
                tell application "Safari"
                    tell window 1
                        set theText to text of document 1
                    end tell
                    -- close document 1
                end tell
                set cell "Text_" to theText
            end tell