Jump to content
Macro Express Forums

Loop or Repeat


Recommended Posts

I have a Macro that I am going to need to run against 100's of 1000's of records. How do I insert the syntax to run a loop in the Macro so that after it finishes running in continues until:

 

A. It is end of the file

OR

B. It has processed a specified amount of records.

 

I would like to be able to do it both ways.

 

Bob

Link to comment
Share on other sites

In these cases I split the %list% into an array and then do a repeat with a counter %C%. Then my first three commands are “If %List[%C%]% ="" (double quote is indicating nothing or null) then break. But if you had a set %limit% I would set the number of times to repeat to %limit%. Obviously this is only when the array elements could exceed the limit.

 

In some cases there are blanks in my list. In those cases I do an additional repeat in front but I count down instead of up to find the first non-blank field. Then I repeat that many times in the main loop. This is also nice for progress indicators. Yo ucould do a condition there to set it to whichever is the smaller value, the number of items in the list or the limit.

Link to comment
Share on other sites

I did figure out the Repeat Command. And it is working pretty well for us. I will definitely start reading about Arrays to start to have a better understanding of the different options I might have to run some of these things we are doing.

 

Bob

Link to comment
Share on other sites

Arrays are the only reasonable way to handle large amounts of datalike you are dealing with. They may seems strange but just think of them ascolumns of data like in Excel. Each column a different array variable and eachrow a different element. Then you just plow thru them with repeats and countersfor the most part just like you go down a spreadsheet row by row.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...