How To Use Min And Max In Loops
This topic explains the use of MIN and MAX in loops.
Requirements
- Understanding of the use of Loops and WHERE clauses
- Experience designing Reports in Collect!
Overview
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.
Examples
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.
@de.tr WHERE (@tr.ty = 151) min = 5
This is often used with forms to create a consistent appearance.
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
@de.tr WHERE (@tr.ty = 151) min = @varLimit
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
|
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: helpinfo@collect.org