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

Show crosstab with lots of column but few rows in same page

Status
Not open for further replies.
Nov 13, 2005
24
CA
WINXP, CRXI

I have a crosstab table with variable columns some over 20 columns but only 5 rows (fixed). The table spans several pages with huge blank space below the table. Is there a way to show/print this table on same page? I tried pivot it, but it still takes several pages.

This is what I have:

A B C D E F G H I J
a 1 1 1 2 3 2 1 3 1 3
b 3 2 4 2 3 1 2 4 5 1

This is what I want:

A B C D E
a 1 1 1 2 3
b 3 2 4 3 3

F G H I J
a 2 1 3 1 3
b 1 2 4 5 1

Any help will be appreciated.
TTM
 
Your question is whether you can make something that is bigger than a page fit on a page...

You can change orientation, paper size, etc., but you're limited to what your printer can do.

If you didn't require printing, you could switch to a HP 3500 CPS printer driver which allows for over 100 inches of space with certain printer settings.

Again, your question doesn't make sense, if you make it larger than a page, why would you expect it to print on one page?

Shrink it or use a larger sized paper. If you don't require printing, don't post that you need it to print in one page, rather just display.

-k
 
If the columns are sequential, you can create a formla like:

if {table.col} in 1 to 5 then 1 else
if {table.col} in 6 to 10 then 2 else 3//etc.

Then insert a group on this formula and place the crosstab in the group header or footer. However, this will mean that your row totals will be limited to those within each group, if that is a factor.

-LB
 
Thanks k and LB for quick response.

k: sorry I am not clear on my point. I do not want to print/shrink to one page, it will still look awkward with a "wide" table having huge blank space below the table.

LB: that might work but I do need a row total, so that is out too.

No other ways around it?

TTM
 
You actually can wrap the crosstab and then show row totals in the last group by using a subreport with a crosstab showing the row totals only, the row labels suppressed. You would then have to suppress the subreport except for the last group.

If you don't have sequential numbers you can use, there is a method for wrapping that also uses subreports. Let me know if you'd like more detail on that. It involves two subreports, one for the main columns, and one for the row totals as just suggested.

-LB
 
LB, I am interested in wrapping the table and make it presentable. The column heading came from a field that is not sequential plus I want the total on the left (column before the first field column), not the last column. Please explain in more detail.

Thanks a million.

TTM
 
Since this method uses a separate crosstab for the row totals, if you place the total crosstab on the left, the five other columns will be indented throughout the report--or would you want to repeat the row totals for each wrap?

-LB
 
Repeating the total (oh! sorry, it is an average, not total, would that matters?)on each wrap is not a problem.

TTM
 
Create a formula {@grp}:

numbervar col;
stringvar x;

if instr(x,{table.columnfield}) = 0 then
(x := x + {table.columnfield};
col := col + 1);
if col in 1 to 5 then 1 else
if col in 6 to 10 then 2 else
if col in 11 to 15 then 3 else
if col in 16 to 20 then 4 else
if col > 20 then 5

Insert a group on this, and then insert a subreport to be placed in the group header. Create the same formula {@grp} in the subreport, and link the subreport to the main report on this formula. Insert your crosstab in the subreport report footer and add the fields the usual way. Suppress all other subreport sections. In the crosstab expert, go to the customize style tab->format grid lines->select the lines around the row labels and uncheck "draw". Then suppress the row labels.

For the average crosstab, add a second subreport which is unlinked. Create the crosstab the usual way, except do not include the column field. Place this on the left and overlay the detailed crosstab so that the rows are aligned.

-LB
 
I think I am getting close but not quite. (Not try the average subreport yet)
The grouping seems to be working but it is still on seperate page. This is how it groups now:

GH1 :Site
GH2 :{@GRP}+ subreport
(coulmn is {table.Unit}
GH3 : Unit (need to show, cannot suppress)
Detail: suppressed

The report shows the correct grp crosstab, but after each grp it shows the Unit GH3 details then goes to the next grp, so that the crosstab is still on different pages.

i.e. grp1 crosstab, GH3 Unit Details of grp1, then
grp2 crosstab, GH3 Unit Details of grp1 and grp2.

I want grp1 crosstab + grp2 crosstab etc. on one page, then
GH3 Unit details (not repeating previous grp Unit details).

It may be a grouping problem, but I do not know how to fix.
Please help.

TTM
 
Sorry, but you did not indicate that your report contained other elements or multiple groups. I'm not sure this solution works reliably when there is more than one group. I don't have time to test right now. Maybe you could put the Groups #3 in a subreport in GF#1? Not sure.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top