ProgressDialog box flickers

I wrote the following code to display a dialogbox/progressbar. It does work (no errors are thrown), but it causes the progress dialogbox to popup and close (giving it a flickering effect). It seems like it opens and closes really quick. I am not really sure what I am doing wrong.

Please advice!

DV Ledger Entry - OnPreDataItem()
TotalRecords := “DV Ledger Entry”.COUNT;
ProgressDialog.OPEN(’#1##########################################’);

DV Ledger Entry - OnAfterGetRecord()
RecordCounter += 1;
PercentageBar := ROUND(10000 * RecordCounter / TotalRecords,1);
ProgressDialog.UPDATE(1, PercentageBar);

This is a processing only report that i am running from RTC.

There’s not much you can do to affect the way that the Dialog data type behaves when you execute the Update function, but you can change your code a bit to cut down on that flicker effect.

Rather than calling Update for every single record in DVLE, consider only updating the dialog window in blocks of 25 or 50 records. There are a few good ways to do that, but the point is to reduce the number of times that you execute the Update function while you’re looping through the recordset. And, there’s a performance advantage too.

The issue was due to the fact that DV Ledger entry dataitem was under another dataitem and that is what was causing the flickering.

I moved the code under the first dataitem, and everything works perfectly.

Here is the final code.

Constituent - OnPreDataItem()

TotalRecords := COUNT;

ProgressDialog.OPEN(’@1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@’);

Constituent - OnAfterGetRecord()

RecordCounter += 1;

PercentageBar := ROUND(RecordCounter/TotalRecords *10000,1);

ProgressDialog.UPDATE(1, PercentageBar);

Constituent - OnPostDataItem()

ProgressDialog.CLOSE;