Brad,
This is an important topic, with a lot of aspects to it, but for now
I can briefly answer your questions.
A record is opened either by an overt Open Record script step or by
any script step which edits it, including Set Field. It is committed
by either an overt Commit Records script step or by any step which
leaves the record (Go to Record, Enter Find Mode, etc.). Regarding
your question: yes, FileMaker does commit the record when it executes
a Go to Record [Next; Exit after last], even though it doesn't leave
the record (it appears that it is an attribute of the Go to Record
step that it always commits the record).
Even though it is inconsistent with the model for globals, there are
times when it is necessary to Commit Records after populating a
global for it to be recognized correctly in subsequent script steps.
I don't think that I can tell you off the top of my head when those
times are... :-(
Danny
At 11:06 AM -0500 7/6/08, Brad Lowry wrote:
Hi All,
FIRST: Simple Question
==================
I know I read this somewhere, but I don't know where, so I can't look back:
That the "GoToRecord[Next, exit after last]" scriptstep will indeed
implicitly "commit" as it goes to the next record. However, can
someone confirm for sure whether or not there is an implicit commit
of the last record upon "exit after last" executing?
If so, I will rest a little easier.
If no, I will begin to toss "CommitRecord" steps at the end of most
of my loops. Not too horrible a fate, but I hope that FM takes care
of this for me.
Thanks in advance for an answer to this specific question.
SECOND: General Commit Rambling
===========================
Of course, even before 7.x many of us had learned that "ExitRecord"
was the "Chicken Soup for FileMaker", that when you don't know what
else is wrong with your script, try it.
With 7.x we all read and read about how the ownership paradigm had
shifted (so wonderfully) and the copious script adjustment necessary.
I will admit, that up until recently (with our belated upgrade) this
consisted of throwing "CommitRecord" steps anywhere that it might
possibly be necessary.I was "black-boxing" by the seat of my pants.
Try it -- Add Commit -- Try it again... I even went as far as to put
a Commit statement after every step of one script to see which
statement was the offending one.
Now with a little bit of the new paradigm sinking into my bones, I
would love someone that has perhaps drunk too much coffee, to
elaborate on a more nuanced sense of committing.
Specifically, I had read that the whole paradigm skipped Globals
completely. Even though new coding uses fewer globals (more
$$globalvariables or just $variables); I have lots of
"if-it-ain't-broke' code. Even though I read that the Commit thing
didn't pertain to globals, I also knew, like Chicken Soup, "It
couldn't hoit"... also, I wondered whether when the global was the
parent key to a child relationship, whether the rules were
different... so I added them.
Now I would love to hear for sure that I was just being
superstitious and that I can skip all committing surrounding
globals.
Thanks in advance for any ramblings on this.
--
Sincerely,
Brad