How can I hide an empty second in crystal reports? - 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.

Related

Crystal Reports: Accessing printed records

I've been working on a report that uses subreports to print records.
The problem is: for the same information, there may be several records - i.e.:
There may be several records for the same product if those records differ in one single column. My goal here is to make a Record Selection Formula that says: "if that item is already shown, then don't show it once again."
I've tried to use (shared) variables for this, but can't seem to find the way, because of the evaluation time.
Selection formulas are already being used to apply some filtering criteria. The column that may differ between two ocurrences of the same record is not always the same, so using a simple Selection Formula is not likely to work...
Any suggestions?
Example:
I used the record selection to tell the report:
"Show me all the products according to these criteria (warehouse=parameter1 and category=parameter2 for example)".
But there may be more than one record for the same product of the same category and inside the same warehouse, if one or more fields are different (for example, different price, different lot)
I want not to display those repetitions.
Your approach is wrong... Record Selection Forumula is something that is applied at report level not on the row level or column level.
If you requirement is not to show the records that duplicates then you need to write the supress condition for those, As per your requirement apply supress condition to the rows or columns.

Crystal Report suppress a whole row in details section

I am using crystal report in my vb.net program. Because of my database design I get some rows duplicated as in the following picture:
As you can see from the picture, the first record has two printer models that have the same ink group. and the next model is the only model that has that particular ink group. As I have mentioned before This is because the way I designed the database and its not the problem. I know how to suppress a single column.
When I select a column and check "suppress if duplicate", the following results show:
The row is suppressed but also has taken a place in the report details.
My question now is how to suppress a whole duplicated row?
thank you
As you are aware that your database design is producing these type of results, one option would be check the option Select Distinct Records so that only distinct records are displayed.
One more option.. This is not a tested one change as you required, This is just an idea
write a condition in supress of the section where you placed your data.
if ID=next(ID)
then true
else false
This condition will make sure that if next row is duplicated then it will be supressed
there is many Options , Easy one Is,
you can use Grouping in Crystal report , in your Example u can Group on ID then Suppress Group Detail and Group Footer Problem Solve Have Fun with Coding

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

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.

Crystal Reports Crosstab Suppress subtotals when there is one row

I am using a crosstab in crystal reports that has 3 grouping levels this can create a lot of subtotals across the rows. Often the subtotal row is useless if there is only one row it is summing from. Is it possible to supress subtotals where there is only one row of data? Leaving the useful subtotals (I know I can suppress the lot).
Illustration below this is how I currently have it:
This is how I would like it to be:
Notice the sub totals for the Middle Grouping B and T have been removed leaving just C as it has two distinct rows below it. To me that looks much cleared and I would be surprised if this can't be achieved.
I recommend skipping the Crystal Crosstab and making your own:
Make a subreport where you want the crosstab to appear (you may not need a subreport, but I'll assume you do).
Group the subreport by your 3 levels.
Drag & drop your fields onto your design however you want them.
In the group footer sections, add some custom field formulas with the sum({number},{group}) for the custom formula.
Using the section expert, suppress the fields as you see fit. The count({number},{group}) would be useful here.
It'll take a fair bit of tweaking to get it right, and of course the columns in your manual crosstab will be fixed, but this allows for the most customization.

crystal report problem

what is the equivalant command like in vb for EOF(), MoveNext, Moveprevious commands in crystal reports
There are no equivalent answers in Crystal Reports, at least not in the versions I have used. Crystal Reports more or less simply dumps the data out into the report.
That said, if you are in a detail row, and you want to find out what the next value of a field will be, you can use:
next({YourColumn})
You can also find out the previous column value by using this:
previous({YourColumn})
Keep in mind that Next() won't work on the last record, and Previous() won't work on the first record.
I'll have to double-check, but I believe there is an OnLastRecord function that returns TRUE if you are on the last record.
First, welcome to SO!
Second, you sound new to Crystal Report's purpose is to display data, not perform the kind of calculations you're talking about. CR usually goes record-by-record through the data, displaying (or suppressing) each record, and adding group headers & footers.
To answer your question, LittleBobbyTables does give a few good pointers. To see the entire list of functions available to you, there is a list in the Formula Editor (see pic below). Press F1 for detailed descriptions of each command.
You can also:
Create a "Running Total Formula" that will evaluate each record and give a calculation in the group footer.
Do the calculations outside of Crystal Reports and only feed the end result in (perhaps with an unlinked join to your primary table).
The most complex option is to make a subreport that does the calculation and feeds the result back to the main report
Can you give us some more details about what you're trying to do?