Jump to content
We've recently updated our Privacy Statement, available here ×

Creating Groups using 2 Fields


rahul.p_1

Recommended Posts

Hi,

 

I am completely new to Jasper Reports and need a little bit of guidance. I am trying to create a report that displays results in groups based on 2 fields.

I am using Jaspersoft Studio 6.21.0 and MariaDB v10.4.32.

The problem I am facing is 2 folds, first, I am unable to format the output in groups and second, I do not know how to sum the values of a column in my result set.

My dataset query is:

SELECT 
	primary_group,
	secondary_group,
	id,
	other1,
	other2,
	other3,
	other4,
	other5,
	other6,
	workdate
FROM 
	myDB.myTbl1
WHERE 
	 myDB.myTbl1.workdate >= $P{varFromDate} 
AND 
	 myDB.myTbl1.workdate <= $P{varToDate}
ORDER BY 
    myDB.myTbl1.primary_group ASC,
	myDB.myTbl1.secondary_group ASC,
	myDB.myTbl1.id ASC,
	myDB.myTbl1.other4 ASC

 

When displaying the result, I've created a group for 'primary_group' and another group under it for 'secondary_group'. In the details section, I have added a table that uses this dataset.

However, my grouping is not working properly.

I need the display to be formatted as attached.

image.thumb.png.300e3ff48d00582759ae0959da21d0f4.png

 

When I generate a preview, the grouping only applies to the 'primary_group' column. The results break off into a new table only when the 'primary_group' field has a new value and displays all 'secondary_group' results in the same table.

I've tried setting the group expression to $F{primary_group}+$F{secondary_group} but I am still having trouble.

The other part of my problem is calculating the sum of one of the columns after each set is displayed.

 

I would be very grateful for any guidance provided.

 

Thank you.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...