IReport - multiple grouping - jasper-reports

I need group data by 5 fields. It's ok, but I need show "Totals" in a new page after each first grouping.
Example:
Birth Nationally Car Job Name Money
1980 North American BMW Doctor Paul $1200,0
1980 North American BMW Lawyer Longman $2700,0
1980 North American Mercedes Nurse Lenna $4200,0
1980 Canadian Mercedes Police John $1300,0
1993 Italian Ferrari Pilot Marco $1500,0
I build my report in this way:
- Main report contain a subreport;
- Subreport (where the groups are):
Birth group header
Nationally group header
Car group header
et...
Car group footer
Nationally group footer
Birth group footer (here I put a SECOND SUBREPORT, that need be in a new page)
Second Subreport: contains the totals by birth, nationally and car, but only actual birth. After each Birth, I need show the sum of money. So, after 1980 would be shown:
1980
Nationally: North American Car: BMW Total: $3.900
Nationally: North American Car: Mercedes Total: $4.200
In a first moment, my subreport 2 didnt work because has no data. So I copied the original data for each object (list X that contains list X). So the subreport 1 uses list X e and pass list X to subreport 2.
But I don't know how to filter the Birth in subreport 2.
Is my solution correct? If yes, how to solve the problem of subreport 2. If no, how should I build that?
Thanks in advance.

Related

Distinct count not giving expected result

I have fields for customer names, customer account numbers, date of previous orders, and order values. I want an alert to show which customers have ordered at least three times over the reporting period. We can have more than one invoice for a given delivery. The main report looks like:
Account Number Acct Name Order Date Order Total
1001 Fred Smith 1/2/2016 £1.06
1001 Fred Smith 1/2/2016 £2.34
1001 Fred Smith 8/2/2016 £5.42
2001 Aled Jones 1/2/2016 £2.90
2001 Aled Jones 8/2/2016 £3.45
I've tried concatenating the account number and order date in a column via function and running an alert based on its distinct count. (After converting the date to a string.) But it still doesn't generate a list of distinct items.
What I currently have in the final column is a function that concatenates the date and account number to give a unique field with {ORDR.CardCode} + Cstr({ORDR.DocDate}) - Which returns:
1001 1/2/2016
1001 1/2/2016
1001 8/2/2016
2001 1/2/2016
2001 8/2/2016
I want to generate alert based on this field via the distinct count function and a report of any customer who ordered at least twice in the report period.
DistinctCount ({#Concat code and date}) >2
Even after this I still don't get what I need. How can I get a list of every customer who has ordered in the report period for at least two times?
You have travelled half way... to achive continue from here.
USe the created formula {ORDR.CardCode} + Cstr({ORDR.DocDate}) to create a group.
place same formula in details and take count of the records in group footer
Now create a alert on group footer summation to get the desired result
Edit........
Since you need customer then add customer in concat fornula and then create group.
acctnamr+{ORDR.CardCode} + Cstr({ORDR.DocDate})
Now place the customer name in group header and follow process as explained above

Crystal Reports Rows in Group

I have a report grouped by Supplier. In the details section for this group, there are customer names with other fields of information. The problem is that a customer may be listed several times, but I only want one record to show per customer.
Supplier
John Doe 10/15 $25.00 Eggs
John Doe 10/15 $29.00 Milk
Susan Weva 10/12 $15.00 Corn
Susan Weva 10/18 $11.00 Bread
What I want is one complete row for John Doe and one for Susan Weva. Any idea as to how I can do this? I tried to suppress each field, but that did not seem to work.
There is one way (which i use in this situations) and it work.
So your data looks like this
John Doe 10/15 $25.00 Eggs
John Doe 10/15 $29.00 Milk
Susan Weva 10/12 $15.00 Corn
Susan Weva 10/18 $11.00 Bread
From what i have understand you want to have your output like
John Doe some columns
Susan Weva some columns
To show it only once per group put fields in group header or group footer. In your case all other columns are different and you should "summarize" those fields. For field price is easy, just do summarize by group and you have for each person amount. But dates and last columns makes a problem. So you should learn about using Cross-tab to solve this problem. If you need only sum of price, then put fields in group header or group footer and it will be show only once per group.
Hope it helps

Crystal Reports: Converting Selected Row Data to Column Data

Is it possible to transpose data for a select column in Crystal? Here is my issue... I am using ttx file to get data fields for the Crystal Report...
I want only the tax_type and the tax_rate and tax amount to show up in the same row as the product sold. The tax_rate is stored in a separate table that needs to be pulled in as a column as well. I need to group and sum on product, buy, sell, tax_type, and then net the whole amount to come up with net total which I kinda know how... but I am stuck at transposing a row. Basically I only want to show row as column where tax type, amount, and rate matches transaction number and YN_tax == 1. The tax rate is stored in a totally separate table... Mind you that tax will not be applicable to each transaction... Here are the table Details
Details Table
Transaction Sales_Date buy_sell Product location ProductType price amount YN_tax tax_type
123456 11/9/2014 Sell DEF Brazil trinkets 5 703.08
123457 11/9/2014 Sell ABC Canada widget 10 213.5
123458 11/9/2014 Buy DEF Brazil trinkets 2 630
123459 11/9/2014 Buy DEF Brazil trinkets 3 34.41
123457 11/9/2014 Sell ABC Canada SalesTax 3 688.2 1 SalesTax
123458 11/9/2014 Buy DEF Brazil FederalTax 2 132 1 FedTax
Tax Rates Table
title rate
SalesTax 8.25
FedTax 9.75
You can do it follow below process.
Before proceeding link the table so that you get title and rate.
Create a formula for every column as you want in the report and write formula as below.
if YN_tax =1
then tax_type
Above formula is for column tax_type in the similar way create individual formulas for all columns.

Transposing Row Data as Columns in Crystal Reports

I have the following data returned from a stored procedure
Staff Category Amount
----- ------- ------
Bob Art 123
Bob Sport 777
Bob Music 342
Jeff Art 0
Jeff Sport 11
Jeff Music 27
All Categories will always be returned for all Staff even is the Amount is zero
What I want to do on my Crystal Report is output this:-
Staff Art Sport Music
----- --- ----- -----
Bob 123 777 342
Jeff 0 11 27
I effectively want to Transpose the data in the Category rows as headers or columns in my report.
I do not want to use a Cross Tab as I have other things I need to add which will not fit nicely into a Cross Tab
Any thoughts on how I can do this in Crystal? I'm using version 11
Should be able to achive this in your sproc with a PIVOT Table. A helpfile on PIVOT tables can be found here
Group the report by staff and place staff, Art, Sport, Music as text fields in Group header.
now in details section place data as
Staff, formula 1 (If Category='Art' then Amount), formula 2 (If Category='Sport' then Amount), formula 3 (If Category='Music' then Amount)
If Staff has only one value then its ok else place Staff in Group footer and take sum of all values in group footer (Don't remove Formula 1,2,3 from details)

Crystal reports -Custom grouping

I have a table called Employee(EmployeeNo,name,Address).Employee number is integer. Employee numbers
prefix is changes according to employees working location. for example
EmployeeNumber - Location
12323 - London prefix "1" says that employee location is in London
24343 - Newyork prefix "2" says that employee location is in Newyork
38989 - Moscow prefix "3" says that employee location is in Moscow.
Now my problem is I don't have separate field to group employee by there location in crystal reports. so I have to get each employee's location using his employee number and group it according to that.
example
London
12323 Thomas sx
13434 Ray xx
14343 Frank uy
NewYork
24545 Alan oo
26656 Robin op
29098 Hayden lp
Moskow
35424 gustov lo
38967 Levshev ol
any idea is appreciated..
Here compulsory scenario should be "Prefix" should be first letter of the location
Use the below code in a formula
Left (<database field>,1 )
Now use the formula to group.
You should be able to group according to lcoation