Hi Again,

I just thought of another, and since there seemed not to be a flurry of
reprimands for the first two, here goes:

When using FM6.x and earlier, the first thing I did upon install of
FileMaker (anywhere) was to disable "add newly defined fields to current
layout".

The reason was that I didn't like my scripts to be dependent on what layout
the application tended to fall on. Since I attempted always to tend to
aggressive "code reuse" I didn't want the layout to be a limitation, thus
instead of using "Replace()" and using a calculation (Replace() being layout
dependent) I would loop through the records and use "Set()" using the same
calculation (Set() being layout independent). When I had no choice other
than to use layout dependent script steps I would document that in the
script, and I would create either a special layout for that script or use my
"DEV" layout (that I have in every file) and be certain that all layout
dependent script steps were executed on either of those two options.

However, now since everything in FM9 is layout dependent I have adopted a
new (personal) best practice: I always rename the "automatic" layout that
results from the initial table creation by appending "_table" to the layout
name (the automatic "books" layout would be renamed "books_table"). I never
change that layout myself *ever*. Instead, whenever I change anything about
a table (perhaps I am going to add "errata_url" to the "books" table) I take
the following steps:
1. Check the "add newly defined fields to current layout"
2. Go to the never changed automatic layout ("books_table" for this example)
3. Go to Manage->Database->Fields and make any changes (add "errata_url"
text field for this example)
4. Uncheck the "add newly defined fields to current layout"

This way I can use these "_table" layouts to universally be the layout to Go
To for all script steps for a given table. Yes, "Set()" doesn't require that
the field be *present* on the layout, just that the layout "show records
from" have that table selected where "replace()" requires the actual field
is present on the layout; regardless, since the distinction between layout
dependent and independent has blurred considerably, with this practice I can
abandon the distinction altogether so long as I am meticulous about
maintaining these "_table" layouts and have no expectation that these
"_table" layouts will ever be used for actual user interface.

(This works well for me, other "best practice" alternatives for this would
be welcomed as responses as well.)

My Wishlist Item for FM9.next (I know, "finally") is that this be embedded
into FileMaker itself. I can think of two alternatives:
1. That FileMaker enforce this "core table" layout as required and always
containing all the fields for the table and make it uneditable directly.
Have FileMaker (programatically) take you to that "_table" layout, check
"add newly defined fields to current layout" while using
Manage->Database->Tables and Manage->Database->Fields. These layouts could
be "negatively numbered" and script steps and layout reordering would only
allow negative for these "_table" layouts and positive for user defined
layouts.

2. Better yet, for every table, allow one to select that table in a new
script step "EnterTableContext()". That is, it would programatically allow
the equivalent of above. That is, having the script step
"EnterTableContext("Books") would allow all script steps for that table
regardless of layout and also emulate the effect of being on a layout for
that table with all fields accessible for what are otherwise "layout
dependent" script steps. So far as permissions, the script writer can
circumvent and field restrictions of users by checking the "run script with
full access privileges" checkbox -- indeed, this script step is much like
this feature. Like error capture, FileMaker would leave whatever context it
was placed in whenever either another EnterTableContext() script step was
encountered or a GoToLayout() script step was encountered ( or window
changing script steps was encountered -- perhaps also, I dunno) or the
script ends. I would even argue that the layout implies the context -- but
for backwards compatability probably not since I am sure that there are many
people that have strategically used the existence or lack thereof of a field
on a layout in their scriptwriting. Adding a new script step for this
feature would not force any rewriting of previously written scripts. Maybe
like the "run script with full access privileges" checkbox, there can also
be an "automatically grant Table Context by layout" checkbox. While we are
on the subject of "Backwards Compatability" it would seem that #2 would win
out over #1 since the upgrade process for #1 would require FileMaker to make
and manage layouts that didn't exist before, whereas #2 is again fully
backwards compatible out of the box.

FWIW $0.02.

Thanks.

-- 
Sincerely,
Brad

Reply via email to