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

Preventing Crosstab from running off page

doodledump

Programmer
Joined
Sep 4, 2024
Messages
10
Hey y'all,

I've got two rather large cross tabs sitting next to each other that I'd like to prevent from overflowing the page horizontally. Is there any way I can restrict how many columns print for each crosstab and just have the cut off columns print underneath the others?

The closest solution I've found was here: https://userapps.support.sap.com/sap/support/knowledge/en/1330019 but my columns don't all have data in them so it's not behaving properly.

I'm using the SP36 plugin for Visual Studio 2022
 
Solution
I ended up finding a work around for anyone experiencing the same problem. Buckle up! It was kind of complicated...

Basically, I needed to generate a "column grouping number" from my database, then use that grouping number as a group in crystal reports. I used MySQL to aggregate all of my column values in the order crystal would print them, then used this formula on the results:
Floor(ROW_NUMBER() OVER() - 1) /# of columns)​

If your cross tab is already being run on an unrelated group, like mine, then add "Partition by x" to OVER() to make sure your column groups restart between any crystal groups you've already got. I ended up with this:
Floor(((ROW_NUMBER() OVER(Partition by timePeriod)) - 1) /4)
A correct group function...
I ended up finding a work around for anyone experiencing the same problem. Buckle up! It was kind of complicated...

Basically, I needed to generate a "column grouping number" from my database, then use that grouping number as a group in crystal reports. I used MySQL to aggregate all of my column values in the order crystal would print them, then used this formula on the results:
Floor(ROW_NUMBER() OVER() - 1) /# of columns)​

If your cross tab is already being run on an unrelated group, like mine, then add "Partition by x" to OVER() to make sure your column groups restart between any crystal groups you've already got. I ended up with this:
Floor(((ROW_NUMBER() OVER(Partition by timePeriod)) - 1) /4)
A correct group function produced this for me:
position
(column values)
timePeriod (Crystal group)groupNumber
a5/20250
b5/20250
c5/20250
d5/20250
e5/20251
f5/20251
x6/20250

Once your group numbers are being correctly generated, Use the group expert to make a group using "groupNumber" and insert your crosstab into that group header. This should spilt your cross tab depending on column how many columns have printed

My reports stucture ended up like this:
Header
GroupHeader 1 timePeriod
GroupHeader 2 groupNumber
Cross Tab
...
 
Solution

Part and Inventory Search

Sponsor

Back
Top