5 Replies Latest reply on Feb 15, 2010 12:00 PM by miw

    Setting a field value running a script

    miw

      Title

      Setting a field value running a script

      Post

      I am having a problem setting a field value running a script.  I tried using both the Set Field and Set Field by Name calculated results to no avail.  Here's the story:  I am in browse mode in TableA that has fields T1, T2 and T3.   I made sure that T2 will take a numeric input in my defined fields.  In my Table A layout, there is a button with an underlying script.  If that button is pushed, for that open (browse) record I want T2 to populate with the number 17 (my script reads as follows:  Set Field [TableA::T2=17]).  For some reason this is not happening.  What am I doing wrong?

        • 1. Re: Setting a field value running a script
          ninja
            

          Howdy,

           

          SetField [ TableA::T2 ; 17 ]

           

          Select the field via the top "Specify..."

          Type "17" (without the quotes) into the calculation window from the bottom "Specify..."

          FMP will put the syntax in for you.

          • 2. Re: Setting a field value running a script
            miw
               Ninja:  I tried your solution and still cannot get the field input to change.  I made sure I was linking the button to the proper script and that I am in browse mode.  Any other suggestions?
            • 3. Re: Setting a field value running a script
              ninja
                

              OK,

               

              Let's check the obvious ones first ...

               

              What table is your layout based on? ...I have assumed it is based on TableA.

              If your layout is based on another, related, table...is this a one to many relationship?

              Actually I don't think this would make much difference, as long as the field you're changing is currently showing.

               

              Does your script step look like mine in all respects (ie. not Insert Text or Insert Calculated Result)?

              Does it have the semicolon now with no "=" sign ?

               

              What field type is your T2 field? (Text, number, calculation...)

               

              Is your script running with FullAccess privileges (box at bottom in ScriptMaker) ?

              • 4. Re: Setting a field value running a script
                miw
                   I missed the semi-colon - but how do I get the semi-colon in the script?  When I type the semi-colon the an error message pops up saying that "an operator (e.g. +,-,*,...) is expected here."  I am clearly missing a step in getting your suggested fix in place.
                • 5. Re: Setting a field value running a script
                  miw
                     Ninja:  I figured out what I was doing wrong; your first answer was right on target - many thanks!