3 Replies Latest reply on Feb 22, 2016 10:08 AM by Mike_Mitchell

    Script to reset all fields

    muskee

      Hi guys, I searched a lot but coudn't find anything that could help me.

      I'm using filemaker pro 14 and i'm trying to make a script that can reset all the fields in a popout button that I have. I'm thinking of something like

      Go to field (first field)

      loop

      set field ("") // or maybe clear (select), not sure

      go to next field

      exit loop if ( current field name = "first field name")

       

      thanks for your help!

        • 1. Re: Script to reset all fields
          siplus

          Wow finally a leak about Filemaker 15: popouts.  Said that, I have a method of clearing up lots of globals (and arrays, too) very fast: a 1-record table containing fields with empty values, with the fields I need to clear up defined as lookup on this table's fields. All I need to do is a relookup and all fields get cleared.

          • 2. Re: Script to reset all fields
            Stephen Huston

            If you want to avoid the structure of a lookup, a simple multi-step script:

             

            SetField ( yourField1 ; "")

            SetField ( yourField2 ; "")

            SetField ( yourField3 ; "")

            etc...

            Commit Record

            • 3. Re: Script to reset all fields
              Mike_Mitchell

              Another option is to use FieldNames and build a layout that has all the fields on it you want to reset. Then do something like this:

               

              Set Variable [ $fieldNames ; Value: FieldNames ( "" ; layoutName ) ]

              Loop

                   Set Variable [ $curField ; Value: GetValue ( $fieldNames ; 1 ) ]

                   Set Field By Name [ $curField ; Value: "" ]

                   Set Variable [ $fieldNames ; Value: RightValues ( $fieldNames ; ValueCount ( $fieldNames ) - 1 ]

                   Exit Loop If [ ValueCount ( $fieldNames ) < 1 ]

              End Loop

               

              HTH


              Mike