Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Preventing form submission when record 'in use' on LAN. How do i check for this?


This topic is 5776 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

hello..

i've been looking now for 2 days on how to make a web form check to see if a record is 'in use' on the LAN (cursor in a field.. or uncommitted record).

currently, if i'm accessing a record on the LAN with someone else on the web, there's nothing to prevent that form being submitted. The obvious problem being that any changes created online are simply ignored on submission. I need to be able to check for 'in use' prior to drawing/loading the form. I could do this manually (we have a 'locked' checkbox), but that's used along with a timestamp, and set AT THE TIME of submission.

all i've found so far in the FM app is a function called "Get (RecordAccess)".. which doesn't seem to be giving me the desired behavior? Is there something i can do on the web side (PHP) that will check for 'in use'?

many thanks!

Posted

Try using:

Get(RecordOpenState)

It returns the following information:

0 for a closed or committed record.

1 for a new record that hasn't been committed.

2 for a modified record that hasn't been committed.

Posted

Try using:

Get(RecordOpenState)

It returns the following information:

0 for a closed or committed record.

1 for a new record that hasn't been committed.

2 for a modified record that hasn't been committed.

thanks for the reply..

however, i made a calc (text) field called 'record_state':

If ( Get ( RecordOpenState ) ≠ 0; "locked" ; "open" )

i put this field on my 'web' layout in filemaker.. but when i go into a field and start changing things, i can't get this value to say "locked", even if i hop to another field (prior to committing the record). Since i can't get a value of "locked", my PHP line:

if ($attendee->getField('record_state') == 'locked') {

echo 'record in use';

}

..will never be true. I've tested this by editing an attendee field and not committing it. When i access the record over the web, my "if" statement thinks the record is "open".

not sure what i'm doing wrong yet.. :

Posted

Your commit() statement should return a Filemaker_Error object (error 301 => 'Record is in use by another user'.) if you try and write to a locked record.

Unfortunately FMP's solution to the Race Condition is less than elegant so if you have users accessing the same table in both the FM client and a web page there is no good solution. e.g. If a user accessing the db via the FM client parks a cursor in a field and goes to lunch, you could have a web user stuck on a page that says "record is locked. please wait a few seconds then click refresh" for a while.

Currently all of our web based data entry into Filemaker tables involve inserts so I haven't had to really think about this yet.

This topic is 5776 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.