The FileMaker Get(OpenRecordState) and Get(RecordOpenCount) Functions

From Dwayne Wright PMP, PMI-ACP, CSM
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

The Get(OpenRecordState) Function
This function  returns the state of the current record for the current user. The state refers to if a user has their cursor within one of the fields and thereby locking the record. The results of this state are returned by this function in the following manner ...

0 - if the record is closed

1 - if this is a newly created record and the current user is still adding the first round of data to it

2 - if this is a previously created record and the current user is currently modifying the data within that record or they simply have their cursor in one of its fields.

This function is not network aware, it will not tell you if another user has a record opened or not.

The Get(RecordOpenCount) Function
The Get(RecordOpenCount) function will return a count of the number of open / uncommitted records in the current found set.

Personally, I had troubles getting this function to work for me but I eventually did. I had tried using an unstored calculation field on the layout but that would not work. I tried multiple open windows with unsaved changes. That did not work as well, which bummed me out because I thought this would be a good way to see if multiple unstored record windows could be tracked. So, this function is dependent upon the current foremost open window.

I resorted to using the Data Viewer (a FileMaker Advanced feature). Then I started to get some results. I would modify one record in a portal and the counter would jump to 2. This includes the parent record and the portal record. I updated another portal record and the counter in the Data Viewer went to 3. This means the other portal record change is still open. I worked my way through 5 portal records and the sequence remained true.

Then I did the revert command, the counter quickly went to zero and the changes in my portal records reverted as well.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.

© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. FileMaker Pro is the registered trademark of FileMaker Inc.