Record Creation via Relationship - Oddity When Auto-Enter Involved

Discussion created by kcunning on Jun 25, 2014
Latest reply on Jun 29, 2014 by keywords

This one took a a while to even figure out what was happening. It's a

little tricky to explain, but it's entirely reproducible, and it has

a side effect of regularly creating extra "blank" records that repeat

existing id numbers. This is causing chaos in my solution.


FileMaker 12 on Mac.


Summary: I have three tables -- OUTER, MAIN, and DATE.


OUTER is related to MAIN via an "id" number field.


MAIN in turn is related to the DATE table by two separate relationships:


"main_to_date2" joins calc2 (=2) in MAIN to "typenum" in DATE

"main_to_date3" joins calc3 (=3) in MAIN to "typenum" in DATE


(Basically, I want to set a type number at the time I set the date so

I have two different kinds of dates and can manage them distinctly.)


On the OUTER table's layout, I place two fields:





If I create a new record in OUTER, then enter date values into the

two fields I put on the layout, I expect the system to create one new

MAIN record (the join), then two new DATE records (one with typenum 2

and the other with typenum 3).


This is in fact what happens in the usual case.




If I have set an auto-enter condition on the "typenum" field in the

DATE table (e.g., Auto Enter data = "1", say), the system again DOES

create the two DATE records as expected (typenum = 2 and 3

respectively, NOT the auto-enter value of 1), BUT it creates *two*

records in the MAIN table. The second record is not a duplicate of

the first record, but a newly-created join record, with the same id

number pulled in from the OUTER record, as if the system had to

create a whole new path through MAIN to get to the DATE table when I

create the second DATE record.


Once the DATE record is created, I can edit it, etc., via the

relationship and no additional middle record is created based on that

relationship, so it only has to do with the creation step. And as

soon as I try to create another DATE record via a *different*

relationship, it adds a new MAIN join record.


(In my case, I actually have *many* of these "main_to_date..."

relationships -- a whole series of typed date fields on one layout --

and a new MAIN join record is created every time a user newly enters

a date in a particular typed entry field because the key field has

the auto-enter condition on it.)


(I should also point out that creating the DATE records from a layout

based on MAIN does NOT have this issue. It has to do with threading

the relationship across the two jumps.)


I could see the behavior going either way. I just didn't expect it to

be different based on whether an auto-enter is set. And note that the

end result in the DATE table *is* the expected behavior -- it's just

the extra superfluous MAIN join records that strike me as odd.




[If you think to say "just turn off auto-enter, you simpleton!", let

me explain that if a user goes directly to the DATE table (on a

different layout based directly on DATE), I want a newly entered

record to default to typenum=1, so naturally I hoped to retain

auto-enter -- of course, the workaround appears to be to unset

auto-enter and have a trigger script on that layout to set the

typenum value to 1 if I want, or to run a trigger script in the cases

I reported above and have that script remove any redundant join

records. But my question is about whether this is expected behavior

or a bug, not how to solve my problem per se. I have solutions now

that I can see what's happening. My question remains: does this seem

like the expected behavior, or is it off? Any explanation that would

elucidate why it's expected?]





Kevin M. Cunningham, M.Ed.

FileMaker 13/12/11/10/9/8/7 Certified Developer | FileMaker TechNet/FBA Member

(617) 229-5081 | kcunning@alum.mit.edu | www.kcunning.com