Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add a header for every nth instances of detail section 2

Status
Not open for further replies.

zencalc

IS-IT--Management
Feb 27, 2002
67
US
I have a report format that needs to repeat a header section (and increase the header section counter by 1) after every 1900 entries in the detail section. I'm not very versed in using variables and print state operators, so if someone could help me on this, I'd appreciate it. Brian
 
A header is only printed once/page...you can enable it easily to repeat on every new page through the Group Expert.

But if you require it more than that then the only way to do it is make one of your detail sections into a fake header

so you would have something like this

Group 1 header
Detail(a) Fake Group1 header
Detail (b) actual data
Group 1 footer

So take the same fields you have in the header and place them exactly the same in the fake header....if one or more of those fields changes then you will have to capture the data you want in the Group 1 header assigning it to a variable in a suppressed formula for later display.

In the Group 1 header you would place the following formula

****************
@Countlines (suppressed in Group 1 header)

WhilePrintingRecords;

If not inRepeatedGroupHeader then
numberVar linecount := 0;
****************

Then in the "real" Detail section place the following
formula :

****************
@IncrementCount (suppressed)

WhilePrintingRecords;

numberVar linecount;

linecount := Linecount + 1;
****************

Now in the Section expert of the "fake header" (detail (A))
place the following formula in the conditional suppress

WhilePrintingRecords;
numberVar linecount;

remainder(linecount,9) <> 0 and not onfirstrecord;

this will suppress the fake section everytime the sum is divisible by 9...except for the first record when Linecount = 0





Jim Broadbent
 
I think this could also be accomplished by creating a second detail section, with detail_b holding the detail data and detail_a holding the periodic &quot;header&quot; that is suppressed with the following formula:

remainder(recordcount, 1900) <> 0

You would enter the suppression formula by going to format section->detail_a->suppress->E-2. Also in format section, you should check &quot;suppress blank section&quot; for detail_a.

-LB

 
lbass - you are assuming every record is used....if it is not the case...it is easy to build-in the conditions into a counting formula that will prevent a bad count.

But now you have me wondering about this application....I read it as every &quot;9&quot; entries...not every 1900 entries.

At one line/entry that would be every 30-35 pages....there is more to this problem than what has been described...that is weird

Jim Broadbent
 
Jim,

You have a good point. When I looked more carefully at my suggestion, I also realized I should have said to place the repeated &quot;header&quot; in the detail_b section, since the requirement was for the header to appear AFTER 1900 entries, not before. If the header is also to appear before the first record, it would need to also be placed in a report header section--maybe report header_b (assuming the requirement is that there NOT be a header per page, but only after 1900 records).

To address your point that some records might not be used (e.g., suppressed or not members of a group select), I would just create a running total {#displayedrecords} using the running total editor that counts an ID field that appears in every row, evaluate based on a formula that allows suppressed or non-group-selected records to be excluded, such as: not({table.ID} in [123,456]), reset never. Then the suppression formula for the detail_b &quot;header&quot; section should be:

remainder({#displayedrecords},1900) <> 0

Running totals using the editor are just canned variables, I guess, but I find them easier, since I don't know that much about creating variables. With these changes, our methods are almost the same, I guess.

-LB
 
Ok, thanks guys, here's the scoop on the report...
the header is at the beginning of the report, or actually within the fake group header section... since when I export this report to csv, if the header info is in the header section, it prints in front of every record in the detail section. This report detail section has 14 lines (or segments) once they are massaged!!! So this fake group header has a counter which needs to be incremented by one, and reprinted after every so many segments... and since I don't want the segments, (lines) to be interrupted within an instance of the detail record, I will choose an arbitrary number which divides evenly into 14, (probably not 1900, it was just an example. So what I'm looking for is to, a) only print the header when 1900 / line number, remainder = 0, and b) increase the count by one. Thanks a bunch... both of your tips will come in handy. (Rack Them!)
Brian
(The only Zen you will find on top of the mountain is that which you bring with you!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top