FAQ: How to set upper limit for progress bar in process procedures

Today I ran into a problem with a process on a SQL table. It was using a range limit and filters so it was only processing a subset of the data. However, the progress bar of course was stuck with the entire data set so it would go up to about 2% and be done. I have a procedure that I can pass some parameters to count the records in a table for a given filter so I knew exactly how many records the process was going to process. But I got stuck on how to reset the high limit for the progress bar. After some snooping around I found a property that I could set and everything worked like a charm.

 !! First get the number of records.  
 !! SQ is a global equate:     SQ Equate('<39>')

 Loc:Recs = CountSQLRecords(Name(MyFile),|
            'Parent_ID = ' & SQ & Loc:Parent_ID & SQ)
 ThisProcess.RecordsToProcess = Loc:Recs

Put this code into priority 8550 or higher in the ThisWindow.Init method in the process procedure and the progress bar will now go smoothly from 0% to 100%

If someone has a method to call for this, please comment on this post. I could not find any method that worked, compiled and ran! Setting the RecordsToProcess property seems to have no bad effects.

Arnor Baldvinsson

Leave a Reply