AnsweredAssumed Answered

Simple Loop Question RE Loop Script Exiting After One Loop

Question asked by tglatt on Feb 27, 2014
Latest reply on Feb 27, 2014 by tglatt

Title

Simple Loop Question RE Loop Script Exiting After One Loop

Post

     I have two tables. 

     One table contains dates and other fields I use to store the results of summary calculations. 

     The second table contains quarterly data for many different customers. 

     I am trying to write a loop script that....

     1. sets a date from the first table in a variable called $Date

     2. performs a find in the second table based on the $Date

     3. sets the results of a count summary field in a new variable called $Count 

     4. updates the count field in the first table with data in the $Count variable for the specified date

     5. repeats the process for the next record

     The problem I am running in to is that the script runs once and then exists.

     Here is what I have...

     Go to Record/Request/Page [First]
     Loop
       Set Variable [$Date; Value:Table1::Date]  
       Perform Find *note criteria is written as Table 2::Date: [=$Date]
       Set Variable [$Count; Value:Table2::a_Count]  *note a_Count is an Average Summary Field
       Replace Field Contents [Table1::Count; $Count]
       Go to Record/Request/Page [Next; Exit after last]
     End Loop

      

     I am sure that the answer is pretty simple, but I am not an expert and am unsure what is causing the problem.

     Any suggestions? 

     Running Filemaker Pro 12

Outcomes