Jump to content
Changes to the Jaspersoft community edition download ×

Recommended Posts

I have a datasource passed from a main report to subreport.

This datasource has two columns - one is a date type(say X) and other is a string type(say Y).

Now I want to group data in Y  based on the X. 

I have used a group header with an expression - $F{X}. For some reason I am not getting a proper output.

This is what I want:

2013-1-6

      Value 1

      Value 2

2013-1-5

     Value 3

     Value4

This is what I am getting:

2013-1-6

      Value 1

2013-1-6

      Value 2

2013-1-5

     Value 3

2013-1-5

     Value4

 

What could I be doing wrong? Please help.

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi sanbez

Thanks for you reply.

The date is Date type and not a Timestamp. And I cannot do .getTime() on my Field because its a String type.

That means, I have a JRMapCollectionDatasource passed to the subreport, which has both X and Y columns as String (X being converted to String by X.toString()). So the two fields $F{X} and $F{Y} are String type.

 

I hope that makes sense.

I have attach my subreport which has the groupheader.

 

 

 

Link to comment
Share on other sites

<?xml version="1.0" encoding="UTF-8"?>

]]></p><p> </queryString></p><p> <field name="SKILL_SET" class="java.lang.String"/></p><p> <field name="COMPETENT_DATE" class="java.lang.String"/></p><p> <variable name="COMPETENT_DATE_1" class="java.lang.Integer" resetType="Group" resetGroup="group1" calculation="Count"></p><p> <variableExpression><![CDATA[$F{COMPETENT_DATE}

$F{COMPETENT_DATE}

$F{COMPETENT_DATE}

$F{COMPETENT_DATE}

$F{SKILL_SET}

 

Link to comment
Share on other sites

after insert query in this subreport:

select '2013-1-6' competent_date, 'Value 1' skill_set from dual union all

select '2013-1-6' , 'Value 2' from dual union all

select '2013-1-5' , 'Value 3' from dual union all

select '2013-1-5' , 'Value 4' from dual

 

I am get next output:

2013-1-6

Value 1

Value 2

2013-1-5

Value 3

Value 4

 

Are you get same result when only subreport run (without main report)?

Link to comment
Share on other sites

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...