Related Information Examples & Tutorials
Want on-line debtor negotiation portal? Contact our friendly sales team to find out how!
“ I am so grateful to your staff and your product for helping to make my business grow. ” Judy A.

How To Use Loops

This topic explains the concept of the Loop used in reports. When you want to pull information from multiple records in the database, the Loop is used to scan through the records according to conditions that you set.

Perhaps you want to list all new debtors for a particular client, or to list all transactions of a certain type or all contacts in a certain date range for a particular operator. Whenever you need to scan through the records in your database to retrieve information that fits your criteria, you would use a loop.

The basic structure of the Loop is as follows.

Loop Structure

@{dialog_code}
{code for data to retrieve}
@{dialog_code}

This basic structure is always used to define the Loop. It begins and ends with the code for the type of record you need to scan for information to include in your report. Each dialog in Collect! has its own code. For instance, @de means the Debtor record and all information that is displayed on the Debtor form. @cl means the Client record and all information that is displayed on the Client form.

So, in general, @{dialog_code} indicates the code for the type of record that you are going to "loop through" in your report.

Next, {code for data to retrieve} indicates the actual field data that you are going to display in your report.

Then, the Loop is closed with the same code that it started with. This means that all loops must begin and end with an identical dialog_code.

Example:

NameFile NumberOwing
@de
@de.na<20> @de.fi<10> @de.ow<13.2>

@de

This loop will scan all Debtor records and print the Debtor Name, Debtor File Number and Amount Owing.

Sample Output:

NameFile NumberOwing
Balford, Allen1287$75.00
Barclay, Tricia1423$5,000.00
Beauchamp, Kim1409$2,448.00
Bernardo, Richard1090$760.48
Bernisky, Sergei1091$150.00
Boag, Peter1425$2,590.00
Booth, Michelle4350$1,095.77
Bradley, William Ryan4339$3,488.45

This example shows a simple loop. You may add conditions to define the criteria for scanning records. Please refer to help topics listed below for further examples.

- How To Use Lists And Loops
- How To Use Where And If Conditions

Top of page.

Troubleshooting Loops

These are few error messages that you might see when you begin to create loops in your reports.

Top of page.

No End Of Loop Marker Found

Failure to end the Loop with an identical dialog_code will result in the following error message displayed in your report output.

"No end of loop marker found matching @de. You must end a loop with the same code you started it with. If you loop with @de to go through debtor information you need to close your loop by again using @de. All the field codes called between the @de's will be printed once per debtor record found."

If you see this error, go back into your report and make sure you have closed your Loop properly.

Top of page.

System Db Errors

When you use a Loop, Collect! has to be able to look at the correct type of record for the information. This means you have to choose the correct record type to "Start On" when you create your report definition. Also, it is necessary to ask for information correctly within the Loop itself. If Collect! cannot find the information it may report Db Error -19 - Record Not Legal Member of Set or Db Error - 8 - Set Has No Current Owner. These mean that you are trying to call for information when you are on the wrong type of record. Please refer to How To Print A List of Records for examples of correctly constructed loops.

Top of page.

See Also

- Report Sample to view sample reports and letters
- Report Topics Index for a list of all report and letter 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: helpinfo@collect.org

Collection Advisor Veracode Verified RMA ACA Member