jkaur Posted February 6, 2013 Share Posted February 6, 2013 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 22013-1-5 Value 3 Value4This is what I am getting:2013-1-6 Value 12013-1-6 Value 22013-1-5 Value 32013-1-5 Value4 What could I be doing wrong? Please help. Link to comment Share on other sites More sharing options...
jkaur Posted February 6, 2013 Author Share Posted February 6, 2013 I am using iReport 4.0.2 Link to comment Share on other sites More sharing options...
sanbez Posted February 6, 2013 Share Posted February 6, 2013 Is dates really equals? Try to display $F{X}.getTime() in group header and compare displayed values Link to comment Share on other sites More sharing options...
jkaur Posted February 6, 2013 Author Share Posted February 6, 2013 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 More sharing options...
jkaur Posted February 6, 2013 Author Share Posted February 6, 2013 <?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 More sharing options...
sanbez Posted February 6, 2013 Share Posted February 6, 2013 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 More sharing options...
jkaur Posted February 7, 2013 Author Share Posted February 7, 2013 I have finally fixed it! All I had to do was sort the dataset before it was passed to the datasource. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now