1 2 Previous Next 29 Replies Latest reply on May 10, 2016 6:40 AM by TSGal

    Get( ModifiedFields ) doesn't work on new record that hasn't been committed

    Jeremiah_Hammond

      Summary

      Get( ModifiedFields ) doesn't work on new record that hasn't been committed

      Product

      FileMaker Pro

      Version

      13v5

      Operating system version

      OS X 10.10.2

      Description of the issue

      Get( ModifiedFields ) should return a list of fields that have been modified in the current record but it doesn't return anything if the record is new (aka it's never been committed to the database). As a FileMaker developer, I would expect this function to work no matter if the record is new or existing.

      Steps to reproduce the problem

      1. Open up Data Viewer and add an expression that outputs Get( ModifiedFields ) so you can monitor it during the steps below.
      2. Create a new record, and make sure *not* to commit to the database.
      3. Modify one or two fields. Again, don't commit.
      4. Notice that Get( ModifiedFields ) is blank.

      Expected result

      Get( ModifiedFields ) should return the fields you modified.

      Actual result

      Get( ModifiedFields ) doesn't return anything.

      Exact text of any error message(s) that appear

      N/A

      Configuration information

      Also doesn't work on Pro 13v4 on Windows.

      Workaround

      None

        • 1. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
          philmodjunk

          This would seem to be expected behavior. The changes aren't actually changes until they are committed back to the file.

          • 2. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
            Jeremiah_Hammond

            Yeah, but what's the harm in returning what fields have been changed before the 1st commit? There's benefit when you are trying to track each change efficiently. If a table has 90 fields and only 4 of them are populated before the 1st commit, it's much more efficient if you could get back a list of those changed fields and audit log them, versus having to check all 90 fields to see if they are populated.

            The Help file wasn't clear on the expected behavior of this function being blank when a new record hasn't been committed. At the very least it should be in there as a note. But again, I don't see the harm in returning the fields that have been changed in a new record.

            • 3. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
              Fred(CH)

              This would seem to be expected behavior. The changes aren't actually changes until they are committed back to the file.

               

              But if you first validate a blank record , then reopen it, change one field and miracle : the function return the field as expected and of course, before the second validation ! So it fail only when state of open record is 1.

              In french too, the Help isn't clear at this point : talking about "open state" without specifying that it not concern new record but only modified record is IMHO a lack.

              And overall, i think this function is simply useless because of this specific point.

              Jeremiah,

              As a workaround, you may would trigg a such simple script to the layout event OnRecordLoad :

              If [Get(RecordOpenState) = 1]
                 Commit Record[No dialog]
                 Go to next field
              End If

               

              Fred

              • 4. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                TSGal

                Jeremiah Hammond:

                Thank you for your posts.

                As you already discovered, Get (ModifiedFields) will not work with an uncommitted new record.  I have forwarded your post to our Documentation manager so this is better explained in the manual.

                TSGal
                FileMaker, Inc.

                • 5. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                  Fred(CH)

                  Thanks for your work TSGal.

                  I will now invoke divinities, to bring the Documentation manager asking to his colleague, the Product manager, for who in the real world, a such behavior can be useful...

                  frown

                  • 6. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                    Fred(CH)

                    PS But of course, the feature request has just been sent to FileMaker, Inc !

                    angel

                    Note for the future visitor : if you want to submit the same feature request, go to the link above, and to save your time, here is a text to copy and paste :

                    In actual state, Get( ModifiedFields ) return an empty string when Get ( OpenRecordState ) = 1. To workaround this strange behavior, we must to first commit the record (even totally blank) and then the function works as expected. In other terms, if one in the world wanted this strange actual result, inserting a simple : If ( Get ( OpenRecordState ) = 2 ; … ) …would have been enough. Make sense ?

                    • 7. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                      philmodjunk

                      TSGal,

                      If I understand Fred correctly, he can get this function to show  modified fields before the record is committed, but only if the record has been committed at least once previously. This would document significantly inconsistent behavior for this get function parameter.

                      Can you confirm that this is the case and that you can reproduce this behavior?

                      • 8. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                        TSGal

                        PhilModJunk:

                        The information from Fred is correct.  If the record (not the data in the record) is not yet committed, then Get (ModifiedFields) will not return a result.  After adding a record, commit the record.  Once the record is committed, Get (ModifiedFields) will return values.

                        TSGal
                        FileMaker, Inc.

                        • 9. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                          Fred(CH)

                          If the record (not the data in the record) is not yet committed, then Get (ModifiedFields) will not return a result.  After adding a record, commit the record.  Once the record is committed, Get (ModifiedFields) will return values.

                          Thank you and sorry TSGal, but i think your definition can be misunderstood, because :

                                 
                          1. This function is designed to return a result when the record is still open (not yet committed), as stated in the documentation.
                          2.      
                          3. A record could be committed 100 times. In this case, the function will fail the first time and succeed 99 times.

                           

                          It is the reason why Phil's description seem more accurate to me (thank you) :

                          Get (ModifiedFields) return a list of modified fields before the record is committed, but only if the record has been committed at least once previously.

                          Thank you both !

                          Fred

                          • 10. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                            TSGal

                            Fred:

                            The description from PhilModJunk means the same thing.  For a "record has been committed at least once previously", implies a record had to be created and then committed.  Regardless, I do like PhilModJunk's explanation better, and I have forwarded this as a suggestion to our Documentation manager.

                            TSGal
                            FileMaker, Inc.

                            • 11. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                              Fred(CH)

                              If the record (not the data in the record) is not yet committed, then Get (ModifiedFields) will not return a result.

                              False : Open an existing record, do a modification on a field. Before commit, check the Get(ModifiedField) result in Data Visualizer : you will see the name of the field.

                               

                              Once the record is committed, Get (ModifiedFields) will return values.

                              False : Get(ModifiedField) only return values when the record is open as stated previously multiple times.

                               

                              With that said, we can easily imagine why this function was designed for : In a OnRecordCommit triggered script, this function allow you to do an pre-commit treatment, for instance if certain particular fields have just been modified.

                              And it will work fine for existing record. However, it will fail for each new record. This why this odd behavior make this function useless, because it kill its primary objective the first time you expect it.

                              and I have forwarded this as a suggestion to our Documentation manager.

                              False : as stated previously, the problem is in the design not in the doc...   wink

                              Don't hate me.

                              Fred

                              • 12. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                                TSGal

                                Fred:

                                I don't hate you.  :-)

                                Let me try to clear up the confusion...

                                An existing record is a record (not the data) that has already been committed.  That is, once a record is created, it is not saved to the database until it is committed.

                                I can see the confusion in the second premise.  Let me rephrase...  "Once the record is committed to the database, then Get (ModifiedFields) will return values for uncommitted data."

                                Currently, this appears to be the current design and does not appear to be changed.  Assuming this doesn't get changed, it should be documented, so that is why the explanation by PhilModJunk was forwarded to the Documentation manager.

                                TSGal
                                FileMaker, Inc.

                                • 13. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                                  Fred(CH)

                                  Thank you for your understanding and great patience TSGal, it is much appreciated smiley.

                                  Now, i think we all agree what is actually doing this Get function, indeed !

                                  If you are right about the fact this is the intended behavior, and the lack is a little omission in the documentation, it would be so nice to get an example of a case in the "real life" where this behavior will be useful, because i don't see any.

                                  And keep in mind that, in many cases, the user who commit a record while clicking outside a field, didn't realize what he have done exactly. It is the reason why, as designed by FileMaker, when he use the command "Delete record", the result will be the same if the record was or wasn't committed once before. And this is the same the reason why, this Get function, is actually not reliable.

                                  Fred

                                  • 14. Re: Get( ModifiedFields ) doesn't work on new record that hasn't been committed
                                    philmodjunk

                                    Now I'm confused as I don't read those the same. Consider this scenario:

                                    You create a record, enter data and commit. You then modify a field, but do not yet commit the record. Does this function list just this one newly edited field as modified or not until the next commit?

                                    1 2 Previous Next