Skip to content

bartzon/rfilemaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rfilemaker

Heavily inspired by lardawge-rfm, see github.com/lardawge/rfm.

This library parses a Filemaker Pro FMPXMLRESULT type document, nothing more, nothing less

Installation

Easy, just use:

gem install rfilemaker

Usage

To parse a Filemaker Pro export file named ‘export.xml’, use:

RFilemaker.parse('export.xml')

This returns an array of hashes, each of which represent a row in your Filemaker database. Fields are automatically converted to their ruby types.

For instance, parsing the following XML export:

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
  <ERRORCODE>0</ERRORCODE> 
  <PRODUCT BUILD="5/23/2002" NAME="FileMaker Pro"
  VERSION="7.0"/> 
  <DATABASE DATEFORMAT="MM/dd/yy" LAYOUT="summary"
  NAME="Employees.fp7" RECORDS="23" TIMEFORMAT="hh:mm:ss"/>
  <METADATA>
    <FIELD EMPTYOK="NO" MAXREPEAT="1" NAME="First Name" TYPE="TEXT"/>
    <FIELD EMPTYOK="NO" MAXREPEAT="1" NAME="Last Name" TYPE="TEXT"/>
    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Department" TYPE="TEXT"/>
  </METADATA>
  <RESULTSET FOUND="2">
    <ROW MODID="47" RECORDID="34"> 
      <COL>
        <DATA>Joe</DATA>
      </COL>
      <COL>
        <DATA>Smith</DATA>
      </COL>
      <COL>
        <DATA>Engineering</DATA>
      </COL>
    </ROW>
    <ROW MODID="89" RECORDID="78">
      <COL> 
        <DATA>Susan</DATA>
      </COL>
      <COL>
        <DATA>Jones</DATA>
      </COL>
      <COL>
        <DATA>Marketing</DATA>
      </COL>
    </ROW>
  </RESULTSET>
</FMPXMLRESULT>

gives this Ruby hash:

[{"last name"=>"Smith", "department"=>"Engineering", "first name"=>"Joe"},
 {"last name"=>"Jones", "department"=>"Marketing", "first name"=>"Susan"}]

The resulting hash is case-insensitive, so keys can be looked up in any given case.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

About

Ruby library to parse Filemaker Pro FMPXMLRESULT files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages