2 Replies Latest reply on Mar 19, 2013 11:54 PM by JeroenValkier

    Field doesn't get updated during loop

    JeroenValkier

      Title

      Field doesn't get updated during loop

      Post

            

           I wrote this script that creates records in the same layout that it loops over (see script code below). The only point where it fails now is at the point where I set the "Status" field of the active record to "New". The field value remains unchanged. The point where it updates the "Amount" field to the value of "15" in the newly created record works perfectly. It also loops nicely and ends when the $FoundRecords reaches "0".
            
           My question: Why doesn't the "Status" field get updated?
            
           =======
           Go to Layout [ “Registrations” (Registrations) ]
            
           Perform Find [ Specified Find Requests: Find Records; Criteria: Registrations::RegistrationID: “<30” ]
           [ Restore ]
            
           Set Variable [ $FoundRecords; Value:Get(FoundCount) ]
            
           Loop
           Go to Record/Request/Page [ $FoundRecords ]
           Set Field [ Registrations::Status["New"] ]
           New Record/Request
           Set Field [ Registrations::Amount; 15 ]
           Set Variable [ $FoundRecords; Value:$FoundRecords - 1 ]
           Exit Loop If [ $FoundRecords = 0 ]

           End Loop

            

        • 1. Re: Field doesn't get updated during loop
          philmodjunk

               Set Field [ Registrations::Status["New"] ]

               is not set up correctly. You have entered "new" in the repetition number box instead of calculated result.

               When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.

          • 2. Re: Field doesn't get updated during loop
            JeroenValkier

                 This was obviously a rookie's mistake :) thanks for answering and solving my problem, and preventing many in the future!