How do you Keep Group Together across columns in Crystal Report? - crystal-reports

I have a multi-column Crystal 2008 report that is grouped on a date field, and I want to prevent that group from being split across the column to column boundary.
Googling it, it seems impossible - no one even has some sort of hack for faking it.
Here is an image of the issue - I would like Friday the 26th to all be in the second column.

Nothing is impossible!
While initially discouraged with the voted answer, I kept searching and found something about using a subreport for the "details". Then I used a mailing label, although this may not be necessary, but in my use I wanted each group to have identical size, this worked perfect to make sure the groups stayed together in the columns. It is a little clumsy but seems the subreport won't cross columns.
Anyway this is an old topic, but thought I would leave this here just in case someone dusts it off.

Looks like this is impossible for now.

Right click the group, select 'Change Group...', select the Options tab, check the 'Keep group together' option.

If you can determine beforehand that you want the group to print on the next column, have a blank detail line extra at the bottom of the detail lines and check the print at bottom of page and suppress it with a formula that is controlled by either a crystal variable or a database field. This is the only way I have found to cause a group to stay together. You find the print at bottom of page in the section expert, add the blank line as the last of your detail lines.

Related

Jasper Report group subreports using columns

I have a master report (using iReport 5.0.4) with a subreport that uses grouping by a field called "Group Number" (sorry, but that is the actual column name).
My report works fine when there are more than one group, but it generates each group result scrolling down the page vertically.
I would like to be able to have each group go across vertically, but when I tried using columns, it simply forces each group's data into columns, and not the entire group 1, followed by group 2 in the next column, etc.
There can be up to 8 groups, so I was hoping not to have to create 8 individual sub-subreports with a "print when" expression to show/hide them.
Can anyone tell me if this should be possible?
Thanks,
Mitch
I think making subreports is the easiest and obvious way. But if you want to make it in other way, I can only suggest to use scriptlet, and form dataset manually (Transpose it).
Another suggestion is when you generating report directly from database (i.e. passing connection into jasper) you can modify query and transpose the data (PIVOT table).
Anyway provide more info about your case. I will try to help you.

iReport "keep group together" does not work in some cases

I have following problem.
I have subreport_1, now irrelevant and then subreport_2, with group header and group footer, with keepTogether = True.
Then I put subreport_1 and subreport_2 in mainReport and execute.
In some occurences, when end of subreport2 is near the end of the page, keepTogether does not work and last row is splitted, with rest, group header and footer on next page.
It works when I change size of bottom margin in mainReport, but I think it can occure again when I have any other row count or so...
Could you help me ?
Thanks
I saw your question posted as an answer to one of my questions (http://stackoverflow.com/questions/13830635/ireport-place-border-around-entire-group-in-column) and then noticed you had created a question of your own. To solve this issue I grouped on the field I wanted to keep together and then in the XML view I added:
keepTogether="true"
to the group definition. It ended up looking like:
<group name="group_foobar" keepTogether="true>
In my report this made it so that a group would not break across pages. In the case where a group could start on a page but not completely fit then it would not print on that page and instead start on the next page.
You say you have used the keepTogether tag in your report. Was that in subreport_2 where the grouping is actually taking place? That's where it would need to be. And since you are performing this grouping in a dynamically expanding subreport, I would set subreport_2 to ignore pagination and set my dimensions in the main report so that the main report can control the pagination.

Crystal reports 2008 report writing

Hi
I'm trying to write my first report!!!
and have number of question I cant seem to find the answer to can anyone help me please!
Q1.
i drag a DB field on the the report which is a string format and need to divide the value by 1024 and display the result. I know i need to use tonumber({fieldname}] but don't know where or how to add this and then do the division. how do I do it?
Q2.
on the report I have a group in its header I have the items that display across the report. in the detail I have the fields of a table that relate to above line. all good so far! How do add another Group or section that would allow another collection of data relating to the same first line!
as I see it I need to add another group with another detail section but I can't do this!
Hope this make some sort of sense!
thanks
Answer 1:
That operation should be done in a formula -- the formula editor will provide views to functionality you can access in that context.
Answer 2:
The Group Editor is what you need to use. You can access it from one of the menus at the top, or by right clicking the row header for the appropriate section IIRC.

Crystal Reports: Cross-Tab Column Arrangements

I am looking for a way out in cross tab, so that if the columns exceed in cross tab, they shouldnt go on next page..rather a new cross-tab should repeat after the first one.
For example, two columns are displayed in a cross tab :
Now if a new column is added, and assuming that it could not be accomodated within the given page width limit, it will go to a page next to it in CR by default.
But in my report it is required to be shown below the first cross tab (and not on next page), which will look as follows:
Please do suggest me if there's a way out :)
Thanks in advance
Your question is perfectly reasonable, but I'm pretty sure that in CR-XI, there is no automatic way to do this. I recommend skipping the cross-tab designer completely and just making your own:
Make a new CR using a placeholder table that has exactly 1 record.
In this CR, suppress everything but the details section. Add a new details section so you will have Da and Db.
In Da, add a subreport. Use your real datasource and add Column1 and Column2.
In Db, add a subreport. Use your real datasource and add Column3 and Column4.
I don't have time to test this, but I think it will display all the columns as you requested.
(Instead of step 1, you can probably use a placegrouper group in your report that only has 1 group. Then, when you add the subreports, make sure to not add any links to the main report.)
Edit
A dynamic number of columns makes this request much more difficult to do in Crystal.
Maybe you could autogenerate the entire report from a script. I couldn't help you with that, but I'm sure someone else on StackOverflow will.
You can use MS Excel to achieve something similar. Use MS Access or something similar to set up a crosstab of your data. Open a new Excel workbook and import your crosstabbed datasource using Data->Import External Data->Import Data (this imports the entire table, regardless of number of rows). In Page Setup, change settings to Fit to (blank) pages wide by 1 pages tall. You can format the data however you like and the format will be retained. This Excel method will squeeze all your columns into a 1-page wide area. It's not quite what you're asking for, but it will work.
The number of columns may be dynamic, but do you know what the field names could be? For example, your columns include 0-50 US States, then you know what the column names will be, just not which ones or how many. If this is your situation, then use my first suggestion (check off the suppress if blank options to hide unneeded subreports). It won't be pretty (alot of white space), but it can get the job done.
A possible solution can be a multi column report. But it can be difficult to make the row labels and values in the same line.
If you can create an additional row grouping then you have the solution that you want. For example if your columns have number like in your sample. Then you can add a formula like:
columnId \ 2

How can I hide an empty second in crystal reports?

I have several groupings in my report, and based on a formula, sometimes there are no rows displayed for the parent grouping. How can I hide the parent grouping if there are no rows displayed? I have SupressIfBlank set to true but that doesn't seem to do anything.
I'm a little rusty, so bear with me....
In the section properties for the group totals, there's a setting for "Suppress", and one of the options is a button that lets you write a formula (in the most recent version I used, this was blue if blank & red if there's a formula written). Click this, it'll take you to the Formula Editor. Write something that counts the rows and returns a Boolean: True for zero rows, False for non-zero.
According to this similar question I found on the Internet, it doesn't seem like CR has this functionality built in. The options presented there are as follows:
Restructure the report's queries so that group headers aren't returned if the detail records are missing. As in you push the formulas down into the queries themselves so that the headers are never returned.
Count the number of detail records on a per-header basis. So you make a formula for the header's suppress field, and suppress it if the detail count is 0.
Either of those should work with the majority of reports. Don't know the specifics of how to implement them, though.