Could not group Data In Jasper Reports
-
06-06-2021 - |
Question
I want to group the shown result set in the image to the shown Report Format in JasperReports. I am using JasperReports 4.5. I googled a lot but could not found the required xml tag to meet my requirement.
Query for the resultset is as follows
select Design, ProfitPer, LabourChg, WgtY, WgtR, TypeName, SetName, ShapeName, Size,
Pieces, Weight, Price, sum(ProfitPer) Profit, round(sum(Cus2),3) Charges from
VDetaillist where design like 'B101E'
group by Design, ProfitPer, LabourChg, CompCost, WgtY, WgtR , TypeName, SetName, ShapeName, Size, Pieces, Weight, Price, SetCost, USS
where Dsign Profit and Charges are the sum values.Design (B101E),ProfitPer,LabourChg,WgtY,WgtR are the non repeated values. And TypeName(Dia,Emarld),Shpae(Round,Square) and Size(4,2.2 * 2.2), Pieces, Weight are repeated values.
Lots of thanks in advance
Solution 2
In the Group Header Band by adding following code in the 'group expression' property :
$F{Design}
Solves my problem.
OTHER TIPS
In the Group Header Band you're using go to properties and for the 'group expression' property try adding this:
$F{Design}+' '+$F{ProfitPer}+' '+$F{LabourChg}+' '+$F{CompCost}+' '+$F{WgtY}+' '+$F{WgtR}+' '+$F{TypeName}+' '+$F{SetName}+' '+$F{ShapeName}+' '+$F{Size}+' '+$F{Pieces+' '+$F{Weight}+' '+$F{Price}+' '+$F{SetCost}+' '+$F{USS}
make sure all of your groupby items are $Fields in your iReport document