home *** CD-ROM | disk | FTP | other *** search
- This hint shows how to modify the standard report skeleton so that it is
- easy to get a band to be "repeated". For example you may wish to print the
- same mailing label 3 times.
-
-
- The first step is to add a new variable, "repeatcount" and a function to
- initialise it. The "switch (band_no)" cases must be customised for your
- particulary application. Add the following code directly before the
- "nextBandRecord" function.
-
-
- int repeatcount[MAX_BANDS+1]; /*NEW*/
- /*NEW*/
- void setRepeatCount(int band_no) /*NEW*/
- { /*NEW*/
- switch (band_no) { /*NEW*/
- case 1 : repeatcount[band_no] = 5; break; /*NEW*/
- } /*NEW*/
- } /*NEW*/
-
- Now we modify the "nextBandRecord" function so it will repeat the appropriate
- records.
-
- /* getTheNextKey(indexFilePtr, &recno[theFile], key[theFile], theBand);
- REPLACE THE ABOVE LINE WITH */
- if (repeatcount[theBand] > 1) { /*NEW*/
- repeatcount[theBand]--; /*NEW*/
- recno[theFile] = tempRecordNumber; /*NEW*/
- ok = True; /*NEW*/
- } /*NEW*/
- else { /*NEW*/
- getTheNextKey(indexFilePtr, &recno[theFile], key[theFile], theBand);/*NEW*/
- setRepeatCount(theBand); /*NEW*/
- } /*NEW*/
- if (ok) getarec(theFile); /*EXISTING LINE*/
-
-
- Finally add another line of code to the end of "establish_link", (this
- function comes dierectly after "nextBandRecord()"), just before the
- last "}" so that "repeatcount" is initialised.
-
- ...
- *(recordready + theBand) = *(nextrecordready + theBand); /*EXISTING LINE*/
- setRepeatCount(theBand); /*NEW*/
- return; /*EXISTING LINE*/ /*NEW*/
- } /*EXISTING LINE*/
-
-
- Now generate the report using this customized skeleton. The
- "setRepeatCount()" function governs the number of duplicates printed.
-