By "file viewer" do you mean Web Viewer?
If you give a web viewer an object name,
Will return the content of that web viewer. It is then possible, though the calculations may not be simple, to extract data from that mass of text to display or store in a field on your layout.
Thanks very much. I did read this from filemaker website. If I understand this says I cannot return web data from Web Viewer
"Developers must also be aware that the Web Viewer will not have the ability to write data back to the
database locally, even though it can receive data from the active database locally"
But the data can be extracted using the GetLayoutObjectAttribute function. If you can get a web site to display the data in the viewer, you can use this function to "scrape" the data out. What you get with this function is a mass of text and formatting tags so you have to develop a meens using text functions to find the specific data within it to extract.
Thanks very much. With luck this shouldn't take to long to do.
I have never used scripts on filemaker. Do not know what to do. I don't even now the name of the web viewer object let alone rename it.
Layout Objects in FileMaker do not have names until you name them. Enter layout mode, select the object such as your web viewer, then enter a name in the name box found at the top of the Inspector's position tab.
After that, I would suggest defining a calculation field that uses GetLayoutObjectAttribute to return the contents of the web viewer to see what you have to deal with.
You'll also need to figure out how to get the web viewer to display the correct data in the first place.
As I warned, this isn't a trivial undertaking as you would still need to develop a calculation or script that extracts the desired data from the text returned by this function.
For a Distance Calculation feature I used GetLayoutObjectAttribute to get the source code of a google map page, then extracted the latitude and longitude using a script
Set Field [ Addresses::webpage; GetLayoutObjectAttribute ( "viewer" ; "content") ] Sets a text field to the source code from the map in the viewer
Set Variable [ $start; Value:Position ( Addresses::webpage ; "lat=" ; 1 ; 1 ) ] Gets the position of the latitude data in the source code
Set Variable [ $startlng; Value:Position ( Addresses::webpage ; "lng=" ; 1 ; 1 ) ] Gets the position of the longitude data in the source code
Set Field [ Addresses::Latitude; Middle ( Addresses::webpage ; $start + 4; 16 ) ] Sets the latitude field to the 16 characters after "lat="
Set Field [ Addresses::Longitude; Middle ( Addresses::webpage ; $startlng + 4 ; 16 ) ] Sets the longitude field to the 16 characters after "lng="
As long as you have a key text phrase to search for in the source code, like "lat=", you can find its position and extract it from the source code.
Thanks very much. I would be lost without you.
Set Field [ Addresses::webpage; GetLayoutObjectAttribute ( "viewer" ; "content") ]
So I would assume that in a regular programming language it would look like.
Addresses.webpage = GetLayoutObjectAttribute ( "viewer" ,"content")
I don't know that much of regular programming language, but that step places the source code of whatever webpage in the viewer into a field called webpage as one long text string. The other steps locate the bits of data I wanted and place them in the latitude and longitude fields. I posted a demo of the file if you want to see how it works. I'm sure same process could be used to extract the 221,619 from after "Amazon Bestsellers Rank:" on their web page.
I am new to Filemaker 11, but I manger to learn enough and get webviewer to return
HTML. I wish that it would return a text representiation of the website instead of HTML
that way the website implentation can change but so long it has the word "sales rank"
I will be able to parse the data out.