10 Replies Latest reply on Mar 12, 2015 5:39 AM by Fred(CH)

    ModifiedFields

    jrenfrew

      FMP13 - Get ( ModifiedFields )

       

      New file

      Table with one field

       

      New record

      Add some data to the field

      tab out runs:

       

      ScriptTrigger onValidate

       

      set a variable $A to Get(RecordOpenState) = 2 (it's open but not committed)

      set a variable $B to Get ( ModifiedFields ) = nothing at all

       

       

       

      in fact I have not yet successfully got this function to work

       

       

      Anyone who has like to share some intelligence??

       

       

       

      john

        • 1. Re: ModifiedFields
          wimdecorte

          works like a charm here, but:

          - it does not return modified related fields (by design).

          - it does not work on a new record.  Those fields are not "modified" in the true sense.

          • 2. Re: ModifiedFields
            jrenfrew

            Wim

             

            got the first bit

            second bit - obvious when you think about it

             

            So

            created a second record, added some data

             

            went back to first

            edited record, when tabbed out script runs but does not give a resutl for function - either in script or dataviewer.

             

            Restarted too just to be doubly sure

            but still no result

             

            john

            • 3. Re: ModifiedFields
              wimdecorte

              works like a charm here.  I can see them in the data viewer.  You have to have exited the field before it registers as being modified, so I guess it only updates after the "onModify" event?

              • 4. Re: ModifiedFields
                BruceRobertson

                Rudimentary example attached. Not that stored dependent calcs are also included but unstored calcs are not.

                • 5. Re: ModifiedFields
                  jrenfrew

                  Thanks Bruce...

                   

                  Got it now.

                  Was trying to do something with a single record virtual record, but of course I need to explicitly commit the record on field validate to trigger the function.

                   

                   

                  john

                  • 6. Re: ModifiedFields
                    BruceRobertson

                    For our amusement here is a modfied version which saves completed or attempted edits but reverts the record if any field contains a forbidden value ("bruce" in the example)

                    • 7. Re: ModifiedFields
                      itraining

                      John, when FMPv13 was released, I stumbled across and experimented (very briefly) with this new feature.

                       

                      I found text fields and calculation (text result) fields were listed in the Get ( ModifedFields ) result but modifications to number, date and time fields did not appear in the Get ( ModifiedFields) result.

                       

                      I did not spend anytime troubleshooting because there were too many other new features to experience. Are you modifying a Text field?

                       

                      Michael Richards

                      Brisbane (Australia)

                      • 8. Re: ModifiedFields
                        BruceRobertson

                        All field types seem to work fine if indexed.

                        • 9. Re: ModifiedFields
                          jrenfrew

                          It was a text field

                           

                          but my error was trying to get the result of the get function in the script after being triggered, rather than sending it to the script as a parameter when validated or saved.

                           

                          I did not want to be using on record save, as this specific case uses a single record layout with several copies of the field which get hidden when required so it can be used a multipurpose input (taking text or a date or a number...) but I wanted to know if in one case a default value had been over-ridden

                           

                          It does now work as changing the field value by using a scripted button and importing the default value from an ExecuteSQL query does not trigger the onfieldsave but typing in manually does

                           

                           

                          john

                          • 10. Re: ModifiedFields
                            Fred(CH)

                            wimdecorte a écrit:

                            […]- it does not work on a new record.  Those fields are not "modified" in the true sense.[…]

                               

                            Hi Wim,

                             

                            I am just struggling with FMI about this particular point and I am surprised you find it natural. Actually, they just promise to update documentation because the help article is not clear at all about this specific point.

                             

                            If I perfectly can understand your opinion about the "semantic" aspect, i disagree in practice aspect.

                             

                            But i am "open mind" , so : in which case actual behavior could be better than if this function worked over both open record states ???

                             

                            Thank you so much for your help !

                             

                            Bye, Fred

                             

                            PS : Sorry for my terrible english