Jump to content
Server Maintenance This Week. ×

Display a loop counter?


Recommended Posts

I sometimes need to loop through thousands of records and perform lengthy calcs on each record, so this operation can take hours or even days to complete. I use freeze window so as to not slow down the operation, but is there a way to display a continuous loop counter or progress bar?

Link to comment
Share on other sites

1 hour ago, human said:

is there a way to display a continuous loop counter or progress bar?

I don't think so. What you could do, though, is pause the script every N records for a fraction of a second. This will refresh the window and update the layout object displaying a counter/progress bar.

You may also want to look into streamlining your calculations. 

 

Link to comment
Share on other sites

Additional things which can help:

1. Be on form view instead of list or table view

2. Run the script via PSOS (Perform Script on Server)

3. Switch to a Utility layout with no fields

I suspect that you are using unstored calculations or even worse - calculations which are based upon other calculations which are based upon even other calculations.  Even with highly-complex structure and complex calculations, it shouldn't take days.  It might be worth allowing a professional Developer to review your file to identify the bottlenecks. 

I hope you figure it out - that would be quite frustrating!

Link to comment
Share on other sites

The main concern is that I haven't messed up the code so as to create an infinite loop. I do run the scripts server-side, normally, and that creates the additional challenge of getting some kind of feedback. The best I have figured out is to send myself emails on errors, or every thousand or few thousand or so steps, so I can see how it progresses.

Link to comment
Share on other sites

5 hours ago, human said:

The best I have figured out is to send myself emails on errors, or every thousand or few thousand or so steps,

Maybe you should consider a different strategy:
Divide your records into groups of say one thousand records each. For each group, perform a separate script on the server and get the feedback through the Get(ScriptResult) and Get(LastError) functions.

 

Link to comment
Share on other sites

16 minutes ago, comment said:

Maybe you should consider a different strategy:
Divide your records into groups of say one thousand records each. For each group, perform a separate script on the server and get the feedback through the Get(ScriptResult) and Get(LastError) functions.

 

That could work, thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.