Crystal report pass last row data in each group to parent report - crystal-reports

I have some question about crystal report pass value from sub report to parent report.
Now I have a sub report group by userID.Now I want to Pass last row Data each UserID . forexample sub report like this:
UserID : Jack
id No Time Diff
1 1 08:10 0
1 2 08:20 10
1 3 08:35 15
Last Row: 1 4 09:10 35
UserID : Peter
id No Time Diff
2 1 08:10 0
2 2 08:40 30
2 3 08:45 5
2 4 08:55 10
Last row: 2 5 09:00 5
Parent report need like this:
UserID No Time Diff
Jack 4 09:10 35 (show last row for jack in sub report)
peter 5 09:00 5 (show last row for Peter in sub report)
How to pass last row for each user to parent ? How can I archive this function?

I realize this is an old question, but hopefully this will still be of use to you.
Since you are returning multiple values to the main report, and the number of total rows is undefined, it may be easier to do the following:
Create a second subreport that is a copy of the first subreport
In the detail section of the new subreport, add the following code to the Suppression formula for the detail section: Next ({YourTable.id}) = {YourTable.id}
Basically, the formula will suppress the detail record if the next record's id is the same as the current id. This way, only the last record for each id will be shown.
You can format the detail line in the second subreport to appear how you want.
The only downside to this is that the subreport will essentially run twice, so if it's a slow report, your report just got slower.

Related

Crystal Report multiple subreports

I need to display multiple subreports on first page then continue printing on next page
I have 2 subreports that I displayed in separate detail sections in my crystal report.
I want both to be displayed in the first page and continued on the next pages.
For example:
Subreport 1 have 8 records
Subreport 2 have 15 records
In page 1
Subreport 1 will display first 5 records
Subreport 2 will display first 5 records
In page 2
Subreport 1 will display records 6-8
Subreport 2 will display records 6-10
In page 3
Subreport 1 will be empty since all records have been printed already
Subreport 2 will display records 10-15

Get consecutive sequence number in ireport

I need to display row number sequence of each group.
I have used $V{PAGE_COUNT} and evaluation time as now
The report data that I am getting is
Group A
1.
2
3
4
...........
page ends ......
Group A
1
2
3
4
page ends ---------
Group B
1
2
3
4
5
page ends....
But my requirement is
Group A
1.
2
3
4
...........
page ends
Group A
5
6
7
8
9
page ends .......
Group B
1
2
3
4
5
page ends....
I need all rows of same group to be continuous sequence. And start sequence from 1 when group is changed
You should use the GroupName_COUNT variable in this case.
The quote from the JasperReports Ultimate Guide
When declaring a report group, the engine automatically creates a count variable that
calculates the number of records that make up the current group (that is, the number of
records processed between group ruptures).
The name of this variable is derived from the name of the group it corresponds to,
suffixed with the _COUNT sequence. It can be used like any other report variable, in any
report expression, even in the current group expression, as shown in the BreakGroup
group of the /demo/samples/jasper sample)
More info is here: Data Grouping

Crystal Crosstab - access summarized values

I am trying to access the summarized fields in a crosstab in order to determine which is the greatest value in a row.
My data displayed is as follows:
Jan Feb Mar Quarter
clerk 1 shoes 0 3 1 4
clerk 1 pants 5 10 10 25
What I need to display on the report is that the major item sold by Clerk 1 is pants.
I am table to do this on a monthly basis but not summary level. Any ideas?
Thanks, Holdfast
You need to insert Embeeded Summary at grand total level and write maximum or minimum formula to retrive, but one issue here is when you insert embeeded summary then you will get extra row at each level of the cross tab.
Note: This is possible in CR 2008 and I have tested in CR 2008

crystal report summary

Data Table
pack_ID qty
1 3
1 4
1 9
2 10
3 1
3 3
I want to display the following in Crystal Report
pack_ID qty
1 16
2 10
3 4
How ?
Insert group on pack_id, insert field summary (sum(qty)) into group footer, hide details section.
simple to do in the sql:
SELECT pack_ID,SUM(qty) FROM Table GROUP BY pack_ID
There is one another way to implement this solution is that if you have less pack_id and need to show this details into particular section instead of dynamically to show the sum of each and every records. Below are the steps:
Create formula Qty_Count_Pack_1 which will store the number of quantity with pack_id 1. You need to create number of formula as per number of pack_id.
if ({command.Pack_Id}) = 1) THEN
{command.Qty}
else
0
Use Summary formula field to sum the Qty which will give the summary of qty for pack_Id 1.
Sum({#Qty_Count_Pack_1},{command.pack_ID})
There are 2 steps as:
Insert Group of pack_ID
Copy qty from detail block to Group of pack_ID the same line
so u can see result as u expect.

counting fields based on group in crystal report

hi all i wana ask a question about crystal reporting in vs 2008
lets say i have a report with these data
customer_ID Customer_Name Order_amoont Order_Date
(#group1 VipCustomer)
1 xyz 3 1/1/2010
2 abc 4 2/2/2010
5 sds 21 3/12/2009
(#Group2 NormalCustomer)
3 tyt 2 3/3/2010
4 ha 4 21/3/2009
i want only to display records where Order_Date year is in 2010 only so i went to the section expert and i added a condintion in suppress formula Year(order_Date)=2010 and i get the result ,,the question is how to count how many vip customers ordered in 2010 only and how many normal customer order in 2010 only ,,then i want the total number of both type of customers to be displayed to have a report like that::
customer_ID Customer_Name Order_amoont Order_Date
(#group1 VipCustomer)
1 xyz 3 1/1/2010
2 abc 4 2/2/2010
subtotal 2
(#Group2 NormalCustomer)
3 tyt 2 3/3/2010
subtotal 1
total 3
i know that answer ,and i will answer it
1-make a conditional formula field and add to it this condtion
if year(Order_Date)=2010 then 1
2-then add summary to the formula filed
--to get total place this summary in the report footer
--to get sub-total place this symmary in group footer
there is also another way to do it
by using running total field and it evaluate section us the formula year(Order_Date)=2010
then to get total place the running field in report footer
to get sub-total make a new running field the same as the 1st but in the reset section check on reset of change of group and place this field in group footer
thnx