| Class | Rfm::Result::Field |
| In: |
lib/rfm_result.rb
|
| Parent: | Object |
The Field object represents a single FileMaker field. It *does not hold the data* in the field. Instead, it serves as a source of metadata about the field. For example, if you’re script is trying to be highly dynamic about its field access, it may need to determine the data type of a field at run time. Here’s how:
field_name = "Some Field Name"
case myRecord.fields[field_name].result
when "text"
# it is a text field, so handle appropriately
when "number"
# it is a number field, so handle appropriately
end
The Field object has the following attributes useful attributes:
Note: Field types match FileMaker’s own values, but the terminology differs. The result attribute tells you the data type of the field, regardless of whether it is a calculation, summary, or normal field. So a calculation field whose result type is timestamp would have these attributes:
Note: Since a field can sometimes appear on a layout more than once, control may be an Array. If you don’t know ahead of time, you’ll need to deal with this. One easy way is:
controls = [myField.control].flatten
controls.each {|control|
# do something with the control here
}
The code above makes sure the control is always an array. Typically, though, you’ll know up front if the control is an array or not, and you can code accordingly.
| global | [R] | |
| max_repeats | [R] | |
| name | [R] | |
| result | [R] | |
| type | [R] |
Initializes a field object. You‘ll never need to do this. Instead, get your Field objects from ResultSet::fields