Class Rfm::Result::ResultSet
In: lib/rfm_result.rb
Parent: Array

The ResultSet object represents a set of records in FileMaker. It is, in every way, a real Ruby Array, so everything you expect to be able to do with an Array can be done with a ResultSet as well. In this case, the elements in the array are Record objects.

Here’s a typical example, displaying the results of a Find:

  myServer = Rfm::Server.new(...)
  results = myServer["Customers"]["Details"].find("First Name" => "Bill")
  results.each {|record|
    puts record["First Name"]
    puts record["Last Name"]
    puts record["Email Address"]
  }

Attributes

The ResultSet object has several useful attributes:

  • server is the server object this ResultSet came from
  • fields is a hash with field names for keys and Field objects for values; it provides metadata about the fields in the ResultSet
  • portals is a hash with table occurrence names for keys and arrays of Field objects for values; it provides metadata about the portals in the ResultSet and the Fields on those portals

Methods

new  

Attributes

date_format  [R] 
fields  [R] 
layout  [R] 
portals  [R] 
server  [R] 
time_format  [R] 
timestamp_format  [R] 

Public Class methods

Initializes a new ResultSet object. You will probably never do this your self (instead, use the Layout object to get various ResultSet obejects).

If you feel so inclined, though, pass a Server object, and some fmpxmlresult compliant XML in a String.

Attributes

The ResultSet object includes several useful attributes:

  • fields is a hash (with field names for keys and Field objects for values). It includes an entry for every field in the ResultSet. Note: You don’t use Field objects to access data. If you’re after data, get a Record object (ResultSet is an array of records). Field objects tell you about the fields (their type, repetitions, and so forth) in case you find that information useful programmatically.

    Note: keys in the fields hash are downcased for convenience (and [] automatically downcases on lookup, so it should be seamless). But if you each a field hash and need to know a field’s real name, with correct case, do +myField.name+ instead of relying on the key in the hash.

  • portals is a hash (with table occurrence names for keys and Field objects for values). If your layout contains portals, you can find out what fields they contain here. Again, if it’s the data you’re after, you want to look at the Record object.

[Validate]