3 Replies Latest reply on Jul 19, 2013 9:16 AM by Matty_1

    Confused by Auto-enter Calculation options

    AshleyWard

      Title

      Confused by Auto-enter Calculation options

      Post

      I've been trying to understand under what conditions an auto-enter calculation takes effect, and I'm confused.  I found a FileMaker document "Defining automatic data entry" here, which says:

      The value is calculated when you create a record, or when one of the referenced fields changes and the destination field is empty.  However, if you select Do not evaluate if all referenced fields are empty in the Specify Calculation dialog box, the value isn't calculated when you create a record and all fields referenced by the calculation are empty. Instead, the value is calculated when one of the referenced fields contains a value.

      I'm very confused by the English there, so I've tried to re-word it, as follows:

      When a new record is created, the auto-entry occurs (ie the calculation is evaluated and the result is filled in).  However, if Do not evaluate if all referenced fields are empty is selected (this is the default), when a new record is created, the auto-entry will only occur if one or more of the fields referenced by the calculation contains a value.  The auto-entry will also occur whenever one of the fields referenced by the calculation changes, as long as the destination field is empty.

      Have I got this straight now?  It still doesn't seem to quite match up with what I see.

      What I'm actually trying to do is add some basic metadata fields to a table in my database, with auto-enter options set to record a modification timestamp and so on.  I want to record the value from Get(SystemNICAddress) too, and I need to use the auto-enter "Calculated value" option to do that.  I've followed some instructions in the "FileMaker Pro 10 Bible" by Ray Cologon (page 620) on how to do this (and some similar instructions are given here), and it works, but I don't understand one part of the solution.  It's good that it works, but I'm a bit frustrated by my incomplete understanding.

      The instructions say to set up the auto-enter calculation to be:

      If (_modifiedTimestamp; Get(SystemNICAddress)

      I don't understand why the "if" and the reference to _modifiedTimestamp are necessary (_modifiedTimestamp is another field I've added, with the more basic auto-enter "Modification:Timestamp" option).  I was expecting the calculation to be simply "Get(SystemNICAddress)".  But if I use that, the field doesn't seem to be updated when the record is modified.

      Also, I'm confused by the possible options in the auto-entry dialog box.  Cologon (page 216) explains that two of the first seven options can be selected: one of the first five, and/or one of the last two, and this seems to be correct, but I don't understand what the expected behaviour is if, say I turn on both Modification:Date and also Calculated Value.  I was expecting that this might cause the Calculated Value to take effect on record modification, but that doesn't seem to be true.

      Can anyone point me to some documentation which defines what the various possible combinations of options in the auto-enter dialog box actually do?  Ie, for each combination, under what exact conditions will the auto-entry occur, and what value will be auto-entered?

      Thanks for any help... Ashley (Confused of Coventry, UK).

        • 1. Re: Confused by Auto-enter Calculation options
          LaRetta_1

          Ashley said, "However, if Do not evaluate if all referenced fields are empty is selected (this is the default), when a new record is created, the auto-entry will only occur if one or more of the fields referenced by the calculation contains a value.  The auto-entry will also occur whenever one of the fields referenced by the calculation changes, as long as the destination field is empty."

          Hi Ashley,

          I believe that you are mixing two things … Do not evaluate if all referenced fields are empty is an option within calculation dialog and, in the auto-enter tab (right below Calculated Value) is checkbox ‘Do not replace existing value if any.’ It is this second checkbox which will determine how the auto-enter behaves.

          I do not have Ray Cologon’s book for vs. 10 but in vs. 9 (pg 187), he does clarify:

          Ray Cologon said, "Okay, we’ll state upfront that, although we love the flexibility offered by the Auto-Enter panel, the user interface bothers us.  When we look at this panel, you see seven checkboxes grouped together and, in both Mac OS and Windows, a checkbox grouping implies that you can select multiple items.  That’s not the case here; the first five checkbox options are mutually exclusive, as are the last two (that is, you can select up to two options – one of the first five and/or one of the last two."

          The first five toggle – only one can be ON.  And the second two toggle. This is what the User inface produces but still … only ONE value can end up in a field and yes, it is confusing; in essence, those auto-enter checkboxes should be radio buttons.  But Ray also says,

          Ray said, "You can configure FileMaker to auto-enter values pertaining to the record’s creation or modification, generate a serial number, seed a field with the value from the last record visited, seed a field with a static initial value, calculation a default value, or retrieve a value from a record in another table."

          If this 'do not replace existing...' checkbox is checked (the default) then it will insert its value at record creation and never change but if unchecked then it will behave like a calculation … updating itself when local fields it references change. 

          BTW, I used the 'quotes' icon and when editing, it displays the quotes in grey box but when viewing in browse, the boxes disappear and then text runs together.

          • 2. Re: Confused by Auto-enter Calculation options
            Matty_1
                 

            If this 'do not replace existing...' checkbox is checked (the default) then it will insert its value at record creation and never change but if unchecked then it will behave like a calculation … updating itself when local fields it references change. 

                 When you say "updating itself when a local fields it references change" does that mean you cannot have the auto enter calculation behave like a normal calculation field and call upon a record in another table unless it's default setting of "Do not replace existing ...." is selected?

                 According to what I've read in the above thread my scenario should work but it is not.  I have two tables related using my purchase record serial ID and a script that creates a new record in a "backbone" table and copy pastes the ID into the appropriate match field forever linking the two together.  In the backbone record I have a FreightcontractID field.  In my purchase Record I have a auto-enter calculation that is simply

                 Backbone_Purchases::FreightContractID and the checkbox unchecked.

                 From what I gather this should be pulling whatever is in the FreightContractID field into my purchases field but it isn't.  Is this because it's in another table?  Ray's remarks make it seem as thought that should still work.

                  

                 Thanks in advance for the help!

                  

            • 3. Re: Confused by Auto-enter Calculation options
              Matty_1

                   Does anyone have some input on this for me?  Thanks :)