Reset count after grouping on crystal reports - crystal-reports

I am writing a report on Crystal Reports 2013. I'm doing multiple groupings on the report and basically, I want a field to be displayed on the first instance of the second group.
Below illustrates what I'm trying to do:
Group 1 a
Group 2 a
Display
Group 2 b
Not Display
Group 2 c
Not Display
Group 1 b
Group 2 a
Display
Group 2 b
Not Display
etc…
Any ideas on how this can be done?

Put this in the suppresion-formula of the field
(Replace {Table.FirstGroupCol} with the column you used to group Group1:
Not (OnFirstRecord Or (Previous({Table.FirstGroupCol})<>{Table.FirstGroupCol}))
This will only display the field on the first record or if the previous value of the column used for Group 1 is different from the current one.

Related

export SSRS Adjacent groups to different excel tabs

I have a ssrs Tablix, i have two adjacent groups , example group 1 : Managers and group 2 : Manager Details . they both are separate adjacent groups. client wants to export them to an excel with two tabs Managers, Details . first sheet should get all data from group 1 and second sheet should get all data from group 2.
can anyone advice.
create two additional rows in dataset with static values of xyz, abc.
for first group , group by xyz column and second group , group by abc column.
in the report make a page based on xyz, abc groups and the result is achieved automatically.

how to count row in crystal report

I've got data as picture below, i'm using crystal report to display statistic report from that data.
i want to count MRN which got 2 until 5 rows of episode number only.
currently im doing
1) group MRN in crystal report and count(episode number).
2) create 1 formula like :
if count(episode number) >=2 and count(episode number)<=5 then count(episode number)"
3) put the formula to report and try to insert summary to count that formula, but no selection summary appear for that formula.
Can you give me an idea how to count MRN with 2 until 5 episode only? refer to picture for clear explanation
In Crystal you can use two condition types to sort which records are being showed:
Record selection formula
Group selection formula
Both are located in the menu Report > Selection formulas
In your case you can define a group on field MRN and create a Count field inside that group. To show only groups where the count is between 2 and 5, use the Selection Formula > Group condition in the Report menu.
Count ({EpisodeNo},{MRN}) <=5 and Count ({EpisodeNo},{MRN})>=2

Multiple Group parameter in aggregate functions

Is this possible? how else can I achieve what I want if it's not?
My report has 3 groups, I want to display the count of records in my details section and it should consider the groups. I created a count formula like Count({FieldToCount},{GroupField1}), this works fine but it only considers 1 group while I have 3.

Require multiple pages for a single bar chart in Crystal Reports 2008

I am creating a bar chart where the values are the maximum of an AVE_ZSCORE field, and this is set as "on change of" a PARTICIPANT_CODE field. On any given occasion, I could have up to 250 records in this chart and therefore I need to split the chart over a number of pages. This number of records is dynamic however, and can range between 150 and 250 records.
I have tried the solution in this thread http://www.tek-tips.com/viewthread.cfm?qid=1257385 and I've followed the instruction as best as I understood (please bear in mind that I'm quite new to Crystal Reports). I created a formula, inserted it in the details section which I then suppressed, then inserted a group on that formula, and inserted the chart in the group footer section. The formula I'm currently using (which I called "chart") to test this out on 4 records is:
WhileReadingRecords;
numbervar cnt := cnt + 1;
if cnt in 1 to 2 then 1 else
if cnt in 3 to 4 then 2
My problem is that the output of this results in 3 graphs of the following instead of 2 graphs containing 2 records each:
a group output of 0.00 which has all 4 records (B2, BB, KK, MM) in
one graph
a group output of 1.00 which has only one of the records (BB)
a group output of 2.00 which also has only one record, which is the
same record of the previous graph (BB)
If I change the formula to display as follows:
WhileReadingRecords;
numbervar cnt := cnt + 1;
if cnt in 1 to 4 then 1
Then the output becomes
a group output of 0.00 which has all 4 records in one graph (B2, BB,
KK, MM)
a group output of 1.00 which has one record (BB)
So firstly, I don't understand the formula that I'm using or how it works, and secondly I have no idea how to get this working so that I can easily specify the number of columns per chart
Unfortunately it's hard to say something without total understanding of your report layout. Some screenshot will easy things alot. As nothing yet specified I expect you have only one (mentioned) group in your report.
To achieve you goal you should render your chart as many times as different group values will be. This is how details section of group is rendered. Not footer or header. As chart can't be added to details section additional dummy group should be created. So in result there will be 2 groups:
Outer group (#1) will be based on your formula field and have no header/footer
Inner group (#2) will be used to show chart in either header or footer
Group #2 can be based on same formula as group #1 (or any other formula/field, it shouldn't matter).
Btw, instead of calculating count manually, like in your code
WhileReadingRecords; numbervar cnt := cnt + 1;
You can use Running total fields, with type of summary count on any field you want to control. Such fields are very customizable, so you'd like them.

Multiple Groups in jasper reports

I want to create multiple groups in ireport, and the data should display in a group-wise manner.For Eg:
First the Group1 data should be printed completely, then,
Group1:
Module Data
After this i want to print the Group2 data completely
Group2:
Category data
I am using the Result Set datasource.
Can Someone help me in this?
Jasper reports will work exactly in this manner as long as your query results are ordered properly.
For example, let's say you are grouping by a field called "MY_GROUP" and it has values "GROUP A" and "GROUP B". In your report you will create a group for field "MY_GROUP". In your query, make sure you have MY_GROUP as the first field in your ORDER BY clause. You can also accomplish this in iReports by adding the "MY_GROUP" field as your the first field in the Sort Options section of the Report query.
Now that you have added your group and are ordering properly your results will come out like this:
Header - GROUP A
Detail - GROUP A
Footer - GROUP A
Header - GROUP B
Detail - GROUP B
Footer - GROUP B
Exactly as you wish. My guess is that you were not properly ordering your query results. This could result in having multiple groupings for GROUP A, GROUP B, etc. all interspersed.
If groups in iReport don't keep all the data together, use subreports. When Jasper gets to a subreport, it runs the whole subreport and puts the whole thing into the report. You could have something like:
Subreport 1 - Group 1
Group 1 first record
Group 1 second record
Group 1 third record
...
Group 1 last record
Subreport 2 - Group 2
Group 2 first record
Group 2 second record
Group 2 third record
...
Group 2 third record
It's exactly as Tom said. Jasper Reports Groups do not order the data retrieved from the query, they just take it in the order it comes.
In order to display the information in a group-wise manner, you have to add an ORDER BY to the query so the rows the report receives are already ordered.
So there is an issue that happens when you use multiple group headers. The first header behaves like expected ordered by Column Value A only on unique values. The 2nd header using Column Value B will print on every row despite being non-unique values.
In theory you should be able to use ORDER BY:
ORDER BY ValueA, ValueB
to properly display the report assuming you are using sql, plsql, etc... However, in my case that did not happen, though for others it seems to work.
Use subreports to attach the minor differences via unique reports. You create a root report with empty details. Then you create Unique reports to serve as sub reprots. Finally, you use the subreport element to link the values into the root report. Though that is a good bit of work and may cause repeat code.
A hacky way I used was: A mixture of "Print When Expressions" with logical boolean expressions with 2 group headers and a column header.
Boolean Expressions:
$F{QUERY}.equals(Query1) && ($P{P_Typequery}.equalsIgnoreCase("QueryA") && $P{P_parameter} == null)
and
$F{QUERY}.equals(Query1) && ($P{P_Typequery}.equalsIgnoreCase("P_QueryA") && $P{P_parameter} != null)
with two group headers and a column header. The column header will not repeat for every row so you assign one of the booleans expressions to it's "print when" so it does not always print. The first group header will not repeat for every row and works. The 2nd group header is used for the times you DO want it to repeat for every unique value since it always prints for every row, and you use the other boolean on it's "print when". Hope it helps