Building a HTML table from Filemaker data

Hi All,

Here's what I'm hoping to achieve and have no clue how:

I have a filemaker (v7 advanced hosted) db. with records for training schedule. I am able to "list" them out on the web with the typical "http://mydomain.com/fmi/xsl/schedule.xsl" type URL. No problems.

And on my homepage, I would like to have a little table displaying the (e.g.) next 5 upcoming events with just the basic details. How should I go about retrieving the data from FileMaker server, build the table and stick it into the homepage.html. I do not wish to have to display the whole page via a xsl document.

I really really hope that this is do-able like in the old version of FileMaker (via CDML).

Thanks in advance!
TC
tc_leuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

billmercerCommented:
You can definitely achieve your goal, in one of a few different ways.

The simplest approach would be to use Instant Web Publishing, which requires basically no programming. For something as simple as you describe, this would be the fastest and easiest approach. IWP is quite limited in many regards, but v7 is much more capable than older versions. It allows lots of scripts to be run for example.

You could also use the new Custom Web Publishing method, which is based on XML instead of CDML. If you aren't already familiar with XML, this will be a big learning curve, so you may want to get a third-party reference to work with. Also, FileMaker's documentation of CWP totally sucks, so you may want to find

A third option would be to use the FX.PHP module, which allows you to query FileMaker databases from a PHP interface. It provides a PHP interface thatn uses XML behind the scenes. Very handy for those who know PHP but are not very good at XML (like me).
billmercerCommented:
Oops, somehow part of my response was missing. I meant to say:

...so you may want to find a reference book that gives more detail. If you have an existing CDML page that does what you want, you can use the CDML to XSLT conversion tool that comes with Server Advanced.

tc_leuAuthor Commented:
Hi Bill,
Thanks for the information. However, I do not wish to be using IWP and since I have already taken the baby steps towards XML and therefore CWP, I would really really like to see a XML approach to this challange.

Thanks again, Bill.

TC
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

tc_leuAuthor Commented:
Hi all,
I've found a solution for my challange. It involves the use of Javascript with its source generated from FileMaker Server Advance via a xsl document. I think this will be useful for many.  I will clean up my codes and share it in my next post.

Thanks all for your time.

TC
billmercerCommented:
Please do, I'd like to see your solution.
tc_leuAuthor Commented:
Hi all,
Here it comes:

1. Create a script entry in the HTML page, specifiying the URL to the xsl document as the source of the JavaScript file:

<script type="text/javascript" src="http://mydomain.com/fmi/xsl/upcoming.xsl" language="JavaScript">
</script>


2. Create a second script entry in the HTML page with a basic document.write() call, with a variable whose content will be filled in by the xsl document.

<script type="text/javascript" language="JavaScript"><!--
document.write( strOutput );
//-->
</script>

3. Now over to the xsl document:
The aim of this document is to produce a javascript assignment statement to the effect of:
      
strOutput = "<table width=\"100%\">
                   <tr><td bgcolor=\"#dfdfdf\">
                   <b>Upcoming Events</b></td></tr>
                   <tr><td bgcolor=\"white\">
                   <p>Event1<br>Location1<br>DateTime1</p>
                   <p>Event2<br>Location2<br>DateTime2</p>
                   </td></tr></table>";
             
Which the javascript code in step 2 will write out in your HTML document. I have broken up the code into separate lines so that it'll be easier to compare with the codes below.

The code for "upcoming.xsl" (I use ... to replace chunks of codes to imporve readability):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet ...>
    <xsl:output method="html"/>
    <?xslt-cwp-query params="...&-max=5"?>
    <xsl:param name="request-query"/>
    <xsl:template match="/fmrs:fmresultset">
   
        <xsl:text>strOutput = "</xsl:text>
            
            <xsl:text disable-output-escaping="yes">
                &lt;table width=\&quot;100%\&quot;&gt;
            </xsl:text>
            
            <xsl:text disable-output-escaping="yes">
                &lt;tr&gt;&lt;td bgcolor=\&quot;#dfdfdf\&quot;&gt;
            </xsl:text>
            
            <xsl:text disable-output-escaping="yes">
                &lt;b&gt;Upcoming Events&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
            </xsl:text>
            
            <xsl:text disable-output-escaping="yes">
                &lt;tr&gt;
            </xsl:text>
            
            <xsl:text disable-output-escaping="yes">
                &lt;td bgcolor=\&quot;white\&quot;&gt;
            </xsl:text>
            
            <xsl:for-each select="/fmrs:fmresultset/fmrs:resultset/fmrs:record">
                  <!-- <p>Event<br>Location<br>DateTime</p> -->
                  
            <xsl:text disable-output-escaping="yes">&lt;p&gt;</xsl:text>
           
            <xsl:value-of select="fmrs:field[@name='eventName']/fmrs:data[1]"/>
            <xsl:text disable-output-escaping="yes">&lt;br/&gt;</xsl:text>
           
            <xsl:value-of select="fmrs:field[@name='location']/fmrs:data[1]"/>
            <xsl:text disable-output-escaping="yes">&lt;br/&gt;</xsl:text>
           
            <xsl:value-of select="fmrs:field[@name='dateTime']/fmrs:data[1]"/>
           
            <xsl:text disable-output-escaping="yes">&lt;/p&gt;</xsl:text>
        </xsl:for-each>
       
        <xsl:text disable-output-escaping="yes">&lt;/td&gt;</xsl:text>
        <xsl:text disable-output-escaping="yes">&lt;/tr&gt;</xsl:text>
        <xsl:text disable-output-escaping="yes">&lt;/table&gt;</xsl:text>
       
        <xsl:text>";</xsl:text>
    </xsl:template>      
</xsl:stylesheet>

4. You can test the output of this code by access <http://mydomain.com/fmi/xsl/upcoming.xsl> directly in your browser and compare it to your desired code e.g. in step 3 above.

That's be it!

Cheers!
TC
tc_leuAuthor Commented:
Hi all,
Let me know if anyone finds the above useful.

Also, now that I have found the solution to my own challenge, what can I do with the points being allocated?

regards,
TC
billmercerCommented:
TC, simply post a question in the Support topic asking for a PAQ/Refund. That way you get your points back, but the solution you came up with will be kept around so it can help other people in the future.
DarthModCommented:
PAQed with points (500) refunded

DarthMod
Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FileMaker Pro

From novice to tech pro — start learning today.