home *** CD-ROM | disk | FTP | other *** search
- This useful hint outlines how to add an array to the standard report skeleton
- so that it is possible to supress output in band(s) or parts thereof while
- still having all the processing done.
-
- 1) As usual the first step is to make a copy of the standard skeleton,
- DBCREP.SKL so that the original code remains intact, though the changes
- are made in such a way that this modified skeleton could be used as the
- standard skeleton.
-
- 2) Add a new global variable, (after the existing declaration at the top of
- the code) :--
-
- bool supressband[MAX_BANDS][5]; /*MOD*/
-
- 3) In the "addLine()" function test "supressband" to see if it is necessary
- to bypass putting backbgound characters and printer codes into the page
- buffer :--
-
- void addLine(int band, int part, int line)
- {
- if (!supressband[band][part]) { /*MOD*/
- ...
- } /*MOD*/
- }
-
- 4) In the "addMemos()" function test "supressband" to see if it is
- possible to bypass processing the memo :--
-
- void addMemos(BOOL memofield, ...
- {
- if (!supressband[band][part]) { /*MOD*/
- ...
- } /*MOD*/
- }
-
- 5) In the "addFields()" function test "supressband" to see if it is
- necessary to bypass putting the field characters into the page buffer:--
-
- void addFields(strptr data, int band, int part, int line, int cond, ...
- {
- ...
- if (*(trim(tempString1, strcopy(tempString2, tempString3, 0, TL)))) {
- if (!supressband[band][part]) { /*MOD*/
- textadded = True;
- if (TL > 0) memmove(((*pagebuffer) + lineno)->line + pos - 1, tempString3, TL);
- } /*MOD*/
- }
- ...
- }
-
- 6) In the "fillDataLine" function test "supressband" to see if it is
- necessary to reset "textadded" to False.
-
- void fillDataLine(int band, int part, int line)
- {
- textadded = (part != _DATA) || (!(*(supressblanks + band)));
- textadded = textadded && !supressband[band][part]; /*MOD*/
- switch (band) {
- ⁿFILLLINEⁿ
- }
- return;
- }
-
- 7) The "PrtBlanks" function needs to by modified so that it can tell if it
- is processing the Header, Data, Control Break or Footer. Add a "part"
- parameter to the function header and then test "supressband" to see if
- "blank" lines should be added at the end of the area being processed. If
- supression is True then set the "blanks" variable back to zero.
-
- Don't forget to update the function prototype at teh begining of the
- program to match the change to the function implementation.
-
- void printBlankLines(int band, int part) /*MOD*/
- {
- if (!supressband[band][part]) { /*MOD*/
- textadded = True;
- while(blanks != 0) {
- blanks--;
- incrementLine(band);
- }
- } /*MOD*/
- else blanks = 0; /*MOD*/
- return;
- }
-
- 8) In the four functions that place calls to "printBlanksLines()" add a
- second parameter, (either _HDR, _DATA, _BREAK, or _FOOTER depending on
- the part of the report being processed), to the call to
- "printBlanksLines()".
-
- void printDataHeader(int band)
- {
- ...
- printBlankLines(band,_HDR); /*MOD*/
- ...
- }
-
- void printDataFooter(int band)
- {
- ...
- printBlankLines(band,_FOOTER); /*MOD*/
- ...
- }
-
- void printDataBand(int band)
- {
- ...
- printBlankLines(band,_DATA); /*MOD*/
- ...
- }
-
- void printControlBreak(int band)
- {
- ...
- printBlankLines(band,_BREAK); /*MOD*/
- ...
- }
-
-
- 9) In the "Initialize" procedure set all the "supressband" elements to
- false. This means that, by default all the report will be printed as
- would normally be the case.
-
- int initialize(void)
- {
- int counter, okStatus, stringLength;
-
- ...
- for (counter = 1; counter <= MAX_BANDS; counter++) {
- *(break_ + counter) = None;
- *(recordsread + counter) = *(recordsprinted + counter) = *(bandstartlno + counter) = 0;
- supressband[counter][_HDR] = False; /*MOD*/
- supressband[counter][_DATA] = False; /*MOD*/
- supressband[counter][_BREAK] = False; /*MOD*/
- supressband[counter][_FOOTER] = False; /*MOD*/
- }
- supressband[0][_HDR] = False; /*MOD*/
- supressband[0][_DATA] = False; /*MOD*/
- supressband[0][_BREAK] = False; /*MOD*/
- supressband[0][_FOOTER] = False; /*MOD*/
- ...
- }
-
-
- With the above modifications in place it is just a matter of re-setting some
- or all of the "supressband" elements so that certain parts of the report
- are processed but not actually printed to the output device.
-
- This could be done by inserting compute fields into a filter associated with
- a particular report, or by using the "Fields/Add/Statement" to insert some
- code statements early in the report definition of the form :--
-
- supressband[2][_DATA] = True; /* Stop Band 2 Data being printed */
-
-
- Note the following constants are already defined :--
-
- #define _HDR 1
- #define _DATA 2
- #define _BREAK 3
- #define _FOOTER 4
-