7 Replies Latest reply on Jun 3, 2009 2:16 PM by DaveParry

    Changing Multiple Value fields



      Changing Multiple Value fields


      I have a table with customer records in. I will do a find to get records from same month last year. I want to then change a value field "reminder" on all the records to a different Value "Sent". I have tried writing a script but cant decide how to do this. Is a script the way or is there some other way.

        • 1. Re: Changing Multiple Value fields

          You have two options:

          1. You can use Replace Field contents from the records menu (or in a script)
          2. You can create a looping script that steps through each record in succession to update a series of records

          Replace Field Contents is a very powerful tool that can change a lot of records. It has many options, so I would read up on it in the help file and test it on a copy of your file until you're confident you've got it working for you. It's also not a good choice in a networked environment. If another user starts to edit one of the records you want to update, this tool will not update that one record and then reports that "1 records was not updated..." and there is no simple way to tell which record was skipped. Thus, it is best used on single user files or under circumstances when you are absolutely sure that no other users might lock one of the records you need to update.


          With a looping script, it takes more effort, but you can check for locked records as you go and devise a means to handle that problem.


          Go To Record [First]


            Set Field [yourtable::Fieldname, Your update data/expression]

            If [get (lastError) ≠ 0]

               #add code here to handle locked records (build a list of skipped records, stop and display an error or ....)

            End IF

            Go To record/request/page [Next, Exit after last]

          End Loop

          • 2. Re: Changing Multiple Value fields


            First I am the only user, so  no problem with locked records.

            How can I select one of the values in the value field. 

            Using either option I cant get it to replace contents of field, (presumably because it is a Value field).

            Have tried using "Sent" in the calculated result but doesnt work. 

            • 3. Re: Changing Multiple Value fields

              Forget that Phil, If I change the first record to Sent, then using Records - replace, it will change the rest to suit.


              I was hoping to use a script,soo I dont have to remember how to do this, but the above works fine. 


              Thanks (once again) for your help. 

              • 4. Re: Changing Multiple Value fields

                You can use replace field contents in a script. You can also use the specify calculation option to specify the value you want stored in your field.


                Be careful about this detail: If you have a check box format with mutliple values, your replace field contents will overwrite existing selections with your specified value.


                Thus a field with "Sent" and "Overdue" check boxes selected will read just "sent" after you do a replace field contents with "sent" specified.

                • 5. Re: Changing Multiple Value fields

                  I have dropdown boxes with "Y", "N" and "Sent" options.

                  If I use a script try to replace with sent it doesnt work. I get "0" instead.

                  Is it because its a drop down box that it doesnt work?

                  I am using "Orders::Reminder = "Sent" in the specify box.

                  • 6. Re: Changing Multiple Value fields

                    Just put "sent" (quotes included) in the specify calculation dialog.


                    Orders::Reminder = "Sent"

                    Is a calculation that will return either true (1) or false (0) depending on the current value of Orders::reminder. That's why you're getting a number instead of the text.

                    • 7. Re: Changing Multiple Value fields
                         Thanks Phil, that sorted it.