4 Replies Latest reply on Jun 22, 2010 9:12 AM by user14830

    SetField Problems

    user14830

      Title

      SetField Problems

      Post

      Hello,

       

      I'm using FM11.  I'm trying to avoid making a copy/paste script by using the set field or set field by name functions. 

       

      Here's what I've entered....  Set Field [Target Field ; Value]

       

      When I type this in the script editor I get an error message that says, "An operator is expected here".  

       

      What am I doing wrong???

        • 1. Re: SetField Problems
          ninja

          Howdy FredB,

           

          Your description is a bit vague...can you reference the specific field?

           

          If I wanted to set a field called "AltPhoneNumber" in a new record to a value from the current record's field called "CellPhoneNumber", it would look like

           

          SetVariable [ $phone ; Value: Table1::CellPhoneNumber ]

          New Record/Request

          SetField [ Table1::AltPhoneNumber ; $phone ]

           

          Does this help?

          If not, could you be specific about the fields and the value you want?

          • 2. Re: SetField Problems
            user14830

            Hi Ninja!

             

            Thanks for your help on this!  To be more specific, I would like a name pasted from one field to another, (in the same record),  based on a value from another field.  Right now I have it working fine but the script steps are copy and paste.  After spending time on this forum I realize that copy/paste isn't a good idea in scripts, (but so far is seems easier).

             

            Here's my formula...

             

            If [Hands::UTGA1 ≠ "F"]

            Set Variable [$R2UTG; Value:Hands::UTG]

            Set Field [Hands::R2UTG ; Hands::UTG]

            End if

             

            The problem is I never can get out of the script editor with the set field line.  I get an error message that reads, "an operator is expected here (eg. +, -, *, /).

             

            All of the examples I've read in this forum seem to have it typed in the same way I'm trying.

             

            Thanks again for your help,

             

            Fred

            • 3. Re: SetField Problems
              ninja

              Howdy FredB,

              If it's in the same record, you don't need the variable...

               


              FredB wrote:

               

              If [Hands::UTGA1 ≠ "F"]

                   Set Variable [$R2UTG; Value:Hands::UTG]

                   Set Field [Hands::R2UTG ; Hands::UTG]

              End if


              Are you choosing the fields from a list when setting this?  You should be.

              Delete your SetField line, then put it back in again.

              Click the top "specify..." button and select Hands::R2UTG from the menu

              Click the bottom "specify..." button and select Hands::UTG from the upper left window of the calculation window

               

              Let FMP take care of the syntax.

               

              Let us know if this takes care of it!

              • 4. Re: SetField Problems
                user14830

                Thank you SO MUCH Ninja!!!

                 

                Works great!