4 Replies Latest reply on Feb 22, 2010 8:52 AM by edocx

    Streamline Field Name Entry

    edocx

      Title

      Streamline Field Name Entry

      Post

      I'm looking for a way to simply my current script so that one script can be used for many fields. The script would find and then test for which field I'm in so that one script can return a value based on the field content. As per example:

       

      If [ (WORKORDERS::RecordComplete = "o") ]

      Set Field [ WORKORDERS::RecordComplete; "x" ]

      Else

      Set Field [ WORKORDERS::RecordComplete; "o" ]

      End If

       

      The script I currently have is set on a field using an invisible box which returns the default value of "box" using the wing ding font. If the field  value is "box" when the field is clicked it will return the value "x in box"...a check box.

       

      I know their has been a lot done to make Filemaker portable any help would be greatly appreciated. 

        • 1. Re: Streamline Field Name Entry
          philmodjunk
            

          Get ( ActiveFieldName ) can return the name of the field where you've currently placed your cursor.

           

          Set Field By Name can then be used to modify the field by the name returned from the above get function.

          • 2. Re: Streamline Field Name Entry
            edocx
              

            I have worked with these function this afternoon but they don't seem to work. Example: Set Field By Name [ Get ( ActiveFieldName ); "o" ]

             

             Maybe its because I am using the field as a button.

             

            Also I can't see what the formula is to initially test for the current field value: If [ (WORKORDERS::RecordComplete = "o") ]

             

             

            • 3. Re: Streamline Field Name Entry
              philmodjunk
                

              Note that I said Get ( ActiveFieldName ) can return the name of the field where you've currently placed your cursor.

               

              If you use the field as a button, you haven't put the cursor into the field. If you want to use the field as a button, use GetFieldName(YourTable::YourField) as the button's parameter.

               

              To test the contents of the field before you modify it, use GetField( get (ScriptParameter) ) if you've passed the field name as a parameter.

              • 4. Re: Streamline Field Name Entry
                edocx
                  

                Thank you Phil for the hints as to the proper structure to use to formulate a script by button and a script which can be repurposed on a use by use basis. What I found is if I name the field I wish to enter as an object and pass the object name to the  “Toggle Check” script as a button using a script parameter the GoToObject script step will send the focus to the "button's" field. Then the field’s current state can be determined (either "x" meaning checked or "o" meaning empty box so the box can be toggled. I then added GotoField[ ] [ Select/perform ] so the field is cleanly exited.  

                I need to mention one more point when the record was created I had auto-enter data set the field to "o" empty box. That way when the form is viewed the empty box is seen which is the analogy to an empty box on a paper form.

                 

                ToggleCheck

                 

                Go to Object [ Object Name: Get ( ScriptParameter ) ] 

                If [ GetField ( Get ( ActiveFieldName ) ) = "o" ]

                Set Field By Name [ Get ( ActiveFieldTableName) & "::" & Get ( ActiveFieldName); "x" ]

                GotoField[ ][ Select/perform ]

                else

                Set Field By Name [ Get ( ActiveFieldTableName) & "::" & Get ( ActiveFieldName); "o" ]

                GotoField[ ] [ Select/perform ]

                End If