3 Replies Latest reply on Aug 7, 2011 9:47 AM by LaRetta_1

    Getting a Script to Enter a Character into a Field

    DavidKlein

      Title

      Getting a Script to Enter a Character into a Field

      Post

      I have used filemaker pro 10 for years, but just started using scripts and calculations.

      I have made a script to find a subset of records.

      I then want the script to enter a character into each of the records in a certain field.

      It could be a 1 or an x or something to indicate that this is "one of those type of records".

      So far I have:

      Enter Browse Mode []

      Perform Find [Restore] (which is working to select the criteria I want)

      Now how do I get it to enter an X in a certain field of each of the found records?

      Thanks!

      dk

       

        • 1. Re: Getting a Script to Enter a Character into a Field
          LaRetta_1

          Once you have your found set then add this step:

          Replace Field Contents [ target field is your new field ; result is whatever you wish, can be 1.  If text you must wrap in quotes. ]

          Is this multi-user or might other Users also want to tag their own records?  If so, this is called tagging and it is not a good approach because if another User tags records then that becomes your tagged set.  If tagging, it is best to gather the IDs of the found set instead.

          • 2. Re: Getting a Script to Enter a Character into a Field
            DavidKlein

            Cool, Will try this and let you know.

            Whle we are on the subject,  I had been trying to use Set Field.

            Why is Replace Field Contents the preferred way?

            Also, on Replace Field Contents, what is the repetition box for in the Specifiy Field Window.

             

            Thanks!

            dk

            • 3. Re: Getting a Script to Enter a Character into a Field
              LaRetta_1

              You won't use the repetition box in this instance; that is for repetition fields.

              Set Field[] is used when you want to set a field in one record.  Replace Field Contents[] replaces the data in ALL records of a found set.  If you wanted, you could have looped through the records and changed each record individually (via script) as:

              Perform Find [ Restore ]
              Loop
              Set Field [ your field ; your value (including calculations) ]
              Go To Record/Request/Page [ next ; exit after last ]
              End Loop

              If you run Replace Field Contents[] and the file is being served, you run into record-locking issues with other users so keep that in mind. :^)