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

Crosstab columns extending beyond one page 4

Status
Not open for further replies.

carynbo

MIS
Feb 11, 2003
57
US
Hi folks. The number of columns in my crosstab spans across two landscape (lettersize) pages. When the crosstab displays, one report title shows, but the columns extend horizontally across the next page. This isn't the same behavior as when rows extend vertically past one page causing a page break.

If possible, I'd like a variable-page crosstab, where the report title displays on each page.

Is there something I can do like force a horizontal page break, with report headers to appear on as many pages as columns in a crosstab takes?

Thanks very much,
Caryn.
 
You can create a repeating report header by going to format cross-tab, clicking on new formula, and entering a "conditional" formula with criteria met by all your selected records and which results in a string--your title or concatenated fields you want displayed in the "header", e.g., if your record select is for all dates >= June 1, 2003:

if {table.date} >= Date(2003, 06, 01) then "My Chart Title"&" "& PrintDate &" "& DataDate

Insert this as the highest order column (remove and reinsert your "real" columns).

Another option you might want to consider is pivoting the crosstab, so that the columns become the rows. This might make sense if you have few rows. Just right click on the chart choose pivot crosstab.

-LB
 
Any string can be used as the first Columns field, as long as you start teh formula with:

WhileReadingRecords;
"Title"





Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
So simple, and yet I didn't know. A star for you.

-LB
 
Thanks very much for your replies, LB and Ken. I hate to be ungrateful, however, I do not seem to be able to use your suggestions in the way I need. The WhileReadingRecords; 'Title' works like a charm for having some text appear within the crosstab on each page, but the amount of 'title' text that displays is limited to the width of the columns that are defined in Design View. i.e., there is 1 database column plus 1 Total column; therefore, the text in @MultPageTitle formula truncates to the space the 2 columns take up in the crosstab design. It cannot extend beyond the width of the crosstab boxes that appear in Design View.

My wishlist includes a centered, 2-lined title over the crosstab, on each page of the crosstab.

What I'd like is:

Page 1 Page 2
My title | My title
Date | Date
Col1 Col2 Col3 ...| Col21 Col22 TOTAL
Row 1 | Row 1
Row 2... | Row 2...


In Preview mode, the page counter shows '1 of 1', even though the width necessitates that the crosstab takes up more than one sheet of paper, indicated by a dashed vertical line.

Is there any way to have a title outside of the crosstab display conditionally, depending on the number of column values that display? Both title and crosstab currently appear in the Report Header -- I've played with RH and RFooter, and it doesn't make a difference.

Also, regardless if I pivot the table or not, the title does not display beyond the first page.

Thanks again for your replies and ideas -- any additional ideas would be greatly appreciated.

Caryn

 
This happens when you modify a cross-tab to add this feature. I think you can fix it. CR will ad a group total for the new field. It will be the second to last column. I think widening this column will solve the problem.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Thanks again Ken -- you are right that extending the added field did the trick, and I could have a formatted, centered heading. The 'but' is, I realize, is that I really need a page break in order to display Rows after the 1st page displays, and page numbers, etc.

Is this beyond the capabilities of CR crosstabs? I'd rather use a crosstab than a 'regular' report since the number of column values changes from time to time, but there may be no other choice.

Caryn

 
You could try writing a formula that groups the first page's columns into one group, and the next page's colummns into another group.

Then group on this formula as primary group and put your Xtab in a group header instead of the report header. This will split the Xtab into two pieces with a real page break.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Thank you Ken,

Your grouping solution solved all of my xtab problems!!

Thanks again!!

Caryn.
 
Hi carynbo,


Can u pls let me know how u have solved this problem.
how u have wrriten a formula that groups the first page's columns into one group, and the next page's colummns into another group.

thanks in advance
 
Hi Davi123,

Here's what I did. Please let me know of any questions.

1. Create a formula 'Page_Group' based on a field that creates two groups of 17 field values for 'fieldA' (17 columns fit across my page).

if {fieldA} in [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q]
then 1
else
then 2

2. Create a group based upon above formula -- Group Expert, group by @Page_Group

3. Put the crosstabs in this group (GH1 on @Page_Group). This splits the crosstab in 2 with a real page break so that headers, footers, and row labels appear on both pages. Report titles and footnotes can go in the PH and PF.

Caryn

 
Hi Caryn,

Thanks for ur reply. I tried ur solution, but that didn't work out for my report. I am writing u in detail abt my report. pls let me know some solution.

I am creating a crosstab report and the requriment is if number of months will be greater than 6 then show the rest of columns separtely because all the 12 columns will not be fit on one page.
This is the structure of report that I want.

Feb Mar Apr May Jun Jul
Customer Name1 1 2 3 4 5 6
Customer Name2 1 2 3 4 5 6
Customer Name3 1 2 3 4 5 6

--------------------------------------------------

Aug sept Oct Nov
Customer Name1 1 2 3 4
Customer Name2 1 2 3 4
Customer Name3 1 2 3 4



I set the repeat row label option in crosstab to repeat the labels, but it's not working. it displaying the report in this way.

Feb Mar Apr May Jun Jul
Customer Name1 1 2 3 4 5 6
Customer Name2 1 2 3 4 5 6
Customer Name3 1 2 3 4 5 6

--------------------------------------------------


1 2 3 4
1 2 3 4
1 2 3 4

-------------------------------------------------


It's not showing the Row and column labels.


Thanks in advance for ur help.
It's urgent so pls let me know the solution ASAP.

Thanks





 
To carry out Carynbo's suggestion you would need to write a formula like ({@pageno}):

if month({table.date}) in 2 to 7 then 1 else 2

In the main report, use {@pageno} as group 1, and place the crosstab in the group 1 header. You would also go to format section->group 1 header and check "New page after."

-LB

 
Thanks for ur reply


It works. But my actual requriment is if number of months will be > 6 then dispaly it in 2 parts and month data can be like that..

Mar-02 Apr-02 May-02 Jun-02 Jul-02 Aug-02 sept-02 Oct-02 N0v-02 Dec-02 Jan-03 Feb-03

in this case report will be like this

Mar-02 Apr May Jun Jul Aug
Customer Name1 1 2 3 4 5 6
Customer Name2 1 2 3 4 5 6
Customer Name3 1 2 3 4 5 6

-----------------------------------------------------

sept-02 Oct Nov Dec-02 Jan-03 Feb-03
Customer Name1 1 2 3 4 4 4 4
Customer Name2 1 2 3 4 3 3 3
Customer Name3 1 2 3 4

-------------------------------------------------------

so the date cycle can start from any month-year. so the requriment is if there will be more then six months display separtely. So i can't hardcode it for 2 to 7. Cycle can be start from Jun-02 to Jul-03. I can start from any month.

Pls let me know the solution.

Again thanks for ur help.

 
Are you using a paramter for the date period? Let's say you have a parameter for the starting month {?startmo} which is a number parameter representing the month number. Then your group formula could be:

if month({table.date}) in {?startmo} to {?startmo} + 6 then 1 else 2

-LB
 
I can't believe nobody jumped in to correct my last post, since it would have resulted in months 13 to 18.

The formula should be based on a parameter for the start date of the crosstab, i.e., a date parameter with a discrete value. The formula would then be:

if {table.date} in {?startdate} to dateadd("m",6,{?startdate}-1) then 1 else
if {table.date} in dateadd("m",6,{?startdate}) to dateadd("m",12,{?startdate}-1) then 2 else 3

You could use this to make group 1, and place your crosstab in the group 1 header. Format the group 1 header to "new page before" but with a condition "Not onfirstrecord". The first 6 months of dates would appear on one page, and the second six months on the second page, etc.

-LB
 
Hi lbass ,

Thank u very much. Now my report is working properly. Ur solution is really helpful for me.

Thanks
 
Hi lbas,

I have one more question. I have to creat serval reports and export those reports to one pdf file. 3 reports are in portarit mode and other reports are in landscape mode.

I am using the landscape reports as subreport in one main report and then exporting that main report to pdf file and also I have set the Paperorentaion of main report to landscape. Now my question is i also want those 3 poratit reports in that PDF file. How I can do that ? If I will add those 3 reports to main report as subreport then Paperorentation for those 3 reports will be changed? Let me know the solution.


Thanks
in advance
 
I have no experience with this, but from what I've read, it appears that the subreports would be forced to adopt the same orientation as the main report. Maybe someone else can be more helpful on this...

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top