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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page titles in an array and scetions going over one page 1

Status
Not open for further replies.

Craigmacs

Programmer
Nov 7, 2002
35
CA
Hello all

I have a large report. the report has 50 details sections.
Some section will run over one page. Each page needs a title.

I want to put all the titles in an array and set a counter that incremints only when a section is finished. That way when one section more than one page it will have the same title on both pages.

MY problem is I can't get the counter to incremint. Where do I put the counter formula and what evaluation time do I use. I need the counter to be a global variable the tells an array in the page header which title to show.

Thank you very much, i've been strugleing with this for a while. Any alternate suggestions are also weclomed.

 
Is the page title either a field in the detail section or a formula based on a detail field? If so, you could just place the field or a formula like the following in the page header:

if {table.field} = 14 then "Sara Smith" else
if {table.field} = 15 then "John Jones" else ""

...with the formula including all possible values of the table.field. Assuming you separate sections by a page break (too big an assumption?), go to format section->detail->new page before and enter:

{table.field} <> previous({table.field})

I may be simplifying too much, so if this doesn't help, please tell us what distinguishes one detail section from another--is there a unique value? And a little information about the section titles would help.

-LB
 
Hello lbass

Right now I am seperating the detail sections I want on one page by new page after.

For example the first 3 detail sections belong on one page.
Each section contains one subreport. If one subreport is larger than expected, ie more than 5 categoires, details a,b are on one page and c is on another. I need a way to repeat the same title for both pages.

To answer your question, No the page titles are not in a database. I want to hard code an array with all the titles in the page header.

I want a variable that will tell the page header array to move to the next title. I can't seam to get the variable to incremint properly. I have been putting it in new page after.
I think I'm trying to do this as if it were vb, any direction is much appericated.
 
do I have this right...you have 50 detail sections each with their own Subreport???

you should describe the report a bit better.

You don't show us how the incrementing is done in the conditional &quot;newPage after&quot;

is it something like this

***************

WhilePrintingRecords;
numberVar pointer; //for the title array

pointer := pointer + 1;

True;

****************

that should work


Jim Broadbent
 
Let me correct a comment I made above. Separate detail sections (a - z) refer to the same row of data, so can't really have a unique identifier, I don't think. I'm assuming that you are trying to label all details (a - z) with the same title, and the title would change for each new detail row. If you mean something else by &quot;detail sections,&quot; please explain.

Something like this should work:

whileprintingrecords;
stringvar array title := [&quot;Birth&quot;,&quot;Youth&quot;,&quot;Mid-Life&quot;, &quot;Emotional Maturity&quot;, &quot;Death&quot;];
numbervar i := 1;
numbervar limit := ubound(title);

for i := 1 to limit do
title := title[recordnumber];
title[recordnumber];

-LB
 
Thanks for the &quot;HELPFUL&quot; reply everyone.

By detail section I mean details a-z.

in the report header I have
************************************************
Global numbervar pointer :=1;

***********************************************
in the page header I have something like this:
*****************************************************
whileprintingrecords;
Global numbervar pointer;
stringvar array title := [&quot;title&quot;,&quot;title1&quot;,&quot;title2&quot;, &quot;title3&quot;];
numbervar i := 1;
numbervar limit := ubound(title);

for i := 1 to limit do
title := title[pointer];
title[pointer];
********************************************************

in the NewPage After I have
********************************************************
WhilePrintingRecords;
Global numberVar pointer; //for the title array

pointer := pointer + 1;

True;
********************************************************

I only get the first element in the array. The Increment doesn't work. The page header always thinks pointer = 1
 
You're mixing methods here. You can place one of the following in the page header:

WhilePrintingRecords;
stringvar array title := [&quot;title&quot;,&quot;title1&quot;,&quot;title2&quot;, &quot;title3&quot;];
numberVar pointer;

pointer := pointer + 1;
title[1] := title [pointer];
title[pointer];

Or:

whileprintingrecords;
stringvar array title := [&quot;title&quot;,&quot;title1&quot;,&quot;title2&quot;, &quot;title3&quot;];
numbervar i := 1;
numbervar limit := ubound(title);

for i := 1 to limit do
title := title[recordnumber];
title[recordnumber];

You do not need a formula in the report header--that is setting the pointer value to one for the entire report.

For &quot;New page after&quot; you just need to check it for the higher order details section (not detail_a, etc.)--no formula necessary.

-LB
 
Hello
Thanks for the reply LB. I'll try to make myself more clear.
If I do
*****************************************************
WhilePrintingRecords;
stringvar array title := [&quot;title&quot;,&quot;title1&quot;,&quot;title2&quot;, &quot;title3&quot;];
numberVar pointer;

pointer := pointer + 1;
title[1] := title [pointer];
title[pointer];
******************************************************

The pages will be titled sequently based on the array.
My problem is that sometimes one detail will be more than one page, when this happens it has to have the same title.
I need the counter to work in newPage after so I have a way of controlling the displayed title.

For examlpe

details a has a sbureport. this subrepot usually fits on one page. However ocassionally there is enough data to push it to two pages. I need the same title on both pages.
NewPage after Incrementing alows me to control the title displayed.

I can't get pointer := pointer +1 to work.
Is it because I try to access it in the header.
Even if I take pointer :=1 out of the report header it still won't work.

Thanks
cmac
 
The methods I described both result in the same title used on a second (or multiple) page(s) if the detail row (detail a-z) extends beyond one page. I plugged in a subreport in detail_a that extended beyond one page, and the first title appeared on both page 1 and 2. Have you tried the suggested methods in full or are you assuming they are insufficient? I have tested these and they work according to what I understand your requirements are, but I can't tell whether you have tried them as suggested.

One thought--these methods are based on the assumption that what you want is one title for detail row #1 sections a - z and a new title for detail row #2 sections a - z. If you are instead trying to create a new title for each of detail#1_a and then detail#1_b, and detail#1_c, please let me know! If my assumption is correct, all you need for a page break is to check new page before on the details (higher order) section and add a formula:

Not Onfirstrecord

Please also verify that you are placing the formula in the page header of the main report, not the subreport.

-LB
 
What excatly do you mean by &quot;detail row #1 sections a - z and a new title for detail row #2 sections a - z&quot;? I would like to know.......

I need to create a new title for each of detail#1_a and then detail#1_b, and detail#1_c. I can't get a varaible to add one to itself when a desired page break,I actually click newPage after or newPage before, occurs.

Thanks for the help.
 
Okay, then, sorry, I misunderstood. Are there subreports in each detail section or do some of the detail sections contain data only from the main report?

-LB
 
To add to my last post, can we assume that the same title repeats for different detail rows, e.g., all detail_a sections have the same title, all detail_b sections have the same title, etc.?

-LB
 
there are only subreports in each detail section no detail sections contain data from the main report.
 
Here's a different approach:

I don't think there's a way of counting detail sections a - z since each section refers to the same row (although I guess this might not be true if the subreports were unlinked). If you try a running total, you will see that each section will contain the same number until the higher order detail changes. So, I think you'll have to manually enter the titles into each detail section, although you could concatenate the title with information that changes per higher order detail. If you were grouping on Customer Id and you had four details sections a - d, you could create four formulas like the following:

{table.customerId} & &quot; - &quot; & &quot;Title 1&quot; //for det_a

In order to get the title changes per page, you need to do this within the subreports. In the main report, suppress the page header and any group headings. Assuming you have a group field in the subreport, suppress the subreport report header and insert multiple group header sections until you have three: group header_a for the title, group_header_b for the group name (if you wish) and group header_c for the column headings. Make sure that within the subreport you go to report->change group expert->options and check &quot;repeat group header on every page.&quot;

This will work as long as there is at least one detail on the second page, if a page break is necessary. To ensure that the group footer or report footer of the subreport is not orphaned and that there are at least two records on the second (or last) page, create a running total within the subreport that counts each row of data. Using the running total editor, choose some recurring field, count, evaluate each record, reset on change of group. Then within the subreport, go to format section->details->new page after-> and enter:

if count({yourgroupfield}, {yourgroupfield}) <> 45 then
remainder({#sub det count},45) = 0 else
if count({yourgroupfield}, {yourgroupfield}) = 45 then
remainder({#sub det count},43) = 0

Or use different numbers--whatever makes sense for your layout.

In the main report, just check &quot;new page after&quot; for each detail section.

-LB
 
Thanks LB, I really appericate the help.
After your comments I have decided there was a design flaw in my report. Now I have the titles in the database.
By suppressing based on group Id I get the desired effect.

Thanks

Craigmacs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top