Related Information Examples & Tutorials
Want to learn more? View the Training Videos in the Collect! Member Resource Center to learn the inside tips on utilizing all that Collect! has to offer to optimize your company's efficiency.
“ Hosted Collect! has saved us time, money, and worry on IT. We no longer have to concern ourselves with keeping a server up and running, replacing aging hardware, managing database backups and facilitating remote access for management/offsite employees. Maintaining a stable internet connection is all that is needed to keep our agents connected and productive. ” John Y.

How To Use Min And Max In Loops

This topic explains the use of MIN and MAX in loops.


- Understanding of the use of Loops and WHERE clauses
- Experience designing Reports in Collect!

Top of page.


Min and Max are mainly used to control output to a predefined space, such as a form. These commands are used in loop structures to determine how many times Collect! will go through a loop looking for information that you prescribe.

Top of page.


For instance, let's suppose you want to print Active Promise contacts in your report. You will want to search through records until you find one. Then, you will print this information. This instance would use the expression max = 1 to accomplish this.

@de.con WHERE (@co.ty = Promise) max = 1

In another instance, you may want to print to a certain area in a form. Whether there are five lines of information or only one pulled from the database, you may want the display to be consistent. You can use min = 5 to print five lines even if four of them are blank. WHERE (@tr.ty = 151) min = 5

tip.gif This is often used with forms to create a consistent appearance.

Top of page.

Variables With Min And Max

MIN and MAX are case insensitive.

As well, you can reference variables with MIN and MAX instead of using a definite number.

For example:

@varLimit = 5 WHERE (@tr.ty = 151) min = @varLimit

Top of page.

See Also

- How To Use Conditionals In Reports
- Report Sample to view all the sample reports and letters
- Report Topics Index to view a list of all report topics

Top of page.

Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.

Please click this link to send us your comments:

Collection Advisor Veracode Verified RMA ACA Member