Solved

Data from Website

Posted on 2011-09-25
2
415 Views
Last Modified: 2012-05-12
Hi
IO would like to know how to copy data from a web page into a field in FM.
I would like to set up a server side script (FM SERVER 11) to open the website XE.COM and copy the selling price of a currency and paste it into a global field or which ever way it can be done. (Exchange Rate).
\I would appreciate any advise on this.
0
Comment
Question by:Krisraychris
2 Comments
 
LVL 25

Accepted Solution

by:
Will Loving earned 500 total points
ID: 36598729
This is done in FileMaker by using a Web Viewer object on a layout and setting the Web Viewer to URL of the site you are trying to capture a value from. The challenge is that you will need to setup a calculation that extracts the data you want from the HTML code that the Web Viewer returns. If that code changes, or for that matter if the URL changes, you will need to alter your capture system.

To capture the text from a specific URL;

create a Web Viewer on your layout
In the Inspector palette, give the Web Viewer Object a name such as "WebViewer1"
Edit the WebViewer (by double-clicking on it) to use the specific URL that you are wanting to go to to get the Exchange Rate
In your script, use Set Variable to capture the resulting text from the URL using GetLayoutObjectAttribute ( "ViewerObjectName" ; "Content" ). In this case you would replace "ViewerObjectName" with the name of your Web Viewer Object
Using the PatternCount() and or other text functions, locate/isolate the particular string you wish to capture. If you are looking for the Exchange Rate for a specific currency, you will have to examine the code to see how that exchange rate appears in the code and then build a calculation to find a locate that specific rate. For example, if your URL is http://www.exchange-rates.org/currentRates/E/GBP and you want to get the current exchange rate for British pounds in Euros, you would need to figure out the exact string of HTML tags that surrounds that value in the table and then extract the value from that string. As noted, if the URL or the web page structure changes, you will likely need to alter your calculation.

For a step-by-step description (written a few years ago) of how to do this, see:

For more detail on using the GetLayoutObjectAttribute() function, see:

0
 
LVL 10

Expert Comment

by:webwyzsystems
ID: 36816492
If you have PHP experience and access to a web server, I think a viable alternative would be building a utility file in PHP to fetch and parse out this information for you. PHP has a much richer toolset to parse than filemaker.

This way when you use the web viewer, filemaker calls your own page and you get exactly what you want into FM, very little parsing around.

Lots more power available to you than in just filemaker alone. Its also nice to push the CPU time onto another process not in filemaker. Keep filemaker fast.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question