Hi all, I’m a newbie to Filemaker and I’ve been looking at various approaches to development in FM, and Karbon, with it’s scripts and separation of concerns, is the closest I’ve seen to the techniques I’ve used in the past (I have a lot of experience with ‘traditional’ RDBMS such as Ingres, Oracle and MS SQL going back to the 1980’s.) Please bear with my ramblings below, I want this to be as clear as I can make it (especially for myself!), but as I’ve limited Filemaker experience all code is pseudo-code/pseudo SQL.
The implicit locking / transaction mechanism in Filemaker seems a little alien to me. I’ve always used explicit Begin / Commit / Rollback transaction statements (using SQL embedded in e.g. C or a 4GL). Maybe there is a request to Filemaker to add these specific scripting commands…
From my experience, ‘last edit wins’ is not a strategy you’d want to allow, especially if it’s silent, as it can lead to lost information and confusion for the user (“I changed that yesterday, where did my change go?”)
Dave’s suggestion of capturing the mod count is exactly what I’ve used to avoid this scenario, with a message to the user to say that the record has been updated elsewhere. In SQL I’d use something like:
SET … update_count = update_count + 1
WHERE … AND update_count = $update_count
IF ERROCODE = 0 AND ROWCOUNT = 0 // successfully updated nothing
<MESSAGE TO USER -> Record has been updated elsewhere, try again>
Would it be possible to implement something like this using the current script/kontroller based mechanism?
I also have a couple of questions about how the locking mechanism works, although may this is the wrong forum for that. I’m trying to get an in-depth understanding of the locking mechanism, and this technical deep-dive is good https://support.claris.com/s/article/SHA06-2019?language=en_US as is Todd Geist’s intro here: http://www.modularfilemaker.org/module/transactions/