pawel_r Posted August 26, 2009 Share Posted August 26, 2009 HiI came across following problem - if I try to produce report, which contains soe parameters (all with default value set) JasperFillManager.fillReport doesn't fill report properly (it produces empty report). It wouldn't be a problem for me if there was some kind of exception thrown - which didn't happen. The servlet was working with no visible problem but all reports were generated empty.It happens if I one of parameters is not supplied in parameter Map(also when Map is empty or null is provided insted of Map parameter) I am using jasperreports engine in version 3.5.3Post Edited by pawel_r at 08/26/2009 07:19 Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 26, 2009 Share Posted August 26, 2009 Hi, Impossible to tell what happens withouth seeing the JRXML. Thanks,Teodor Link to comment Share on other sites More sharing options...
pawel_r Posted August 27, 2009 Author Share Posted August 27, 2009 The most important part here is (AFAIK) <parameter name="START_DATE" class="java.util.Date"> <defaultValueExpression><![CDATA[new java.util.Date()]]></defaultValueExpression> </parameter> <parameter name="END_DATE" class="java.util.Date"> <defaultValueExpression><![CDATA[new java.util.Date()]]></defaultValueExpression> </parameter> <parameter name="REPORT_TYPE" class="java.lang.String"> <defaultValueExpression><![CDATA["M"]]></defaultValueExpression> </parameter> In attachment there is the whole jrxml file (without SQL query) Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 28, 2009 Share Posted August 28, 2009 Well, the most important part was the SQL query. Teodor Link to comment Share on other sites More sharing options...
pawel_r Posted August 31, 2009 Author Share Posted August 31, 2009 If you say so... I was quite sure that problem lies not in SQL query. Thank you for your patienceCode:SELECT chre.TYPE AS chre_TYPE, (Select count(chre2.id) from change_requests_h chre2 where chre2.id=chre.id) as "Liczba zmian", (Select count(chre2.id) from change_requests_h chre2 where (Select valid_from from change_requests_h Where executed_action = 'ZAMKNIECIE_ZMIANY' And change_requests_h.id = chre2.id) <= chre2.on_prod_introduction_date and chre2.id=chre.id group by chre2.id) as "Liczba zmian terminowych", chre.BUSINESS_ID AS chre_BUSINESS_ID, chre.TITLE AS chre_TITLE, SYSTEM_USERS.DISPLAY_NAME AS SYSTEM_USERS_DISPLAY_NAME, PROCESS_STAGES.NAME AS PROCESS_STAGES_NAME, chre.ID AS chre_ID, chre.ON_PROD_INTRODUCTION_DATE, USER_GROUPS.NAME AS USER_GROUPS_NAME, MY_DATA.NAME, MY_DATA_SOJOURNS.entry_timestamp, MY_DATA_SOJOURNS.EXIT_TIMESTAMP, MY_DATA_SOJOURNS.DUE_DATEFROM MY_DATA MY_DATA INNER JOIN MY_DATA_SOJOURNS MY_DATA_SOJOURNS ON MY_DATA.ID = MY_DATA_SOJOURNS.PRST_ID INNER JOIN CHANGE_REQUESTS chre ON MY_DATA_SOJOURNS.ID = chre.PRIN_ID INNER JOIN USER_GROUPS USER_GROUPS ON chre.USGR_ID = USER_GROUPS.ID INNER JOIN SYSTEM_USERS SYSTEM_USERS ON chre.SYUS_ID_PM=SYSTEM_USERS.ID INNER JOIN DATA_STAGES DATA_STAGES ON MY_DATA.PRSG_ID = DATA_STAGES.ID WHERE chre.type IN ('DEVELOP_STANDARD','DEVELOP_SHORT_PATH')ANDchre.ON_PROD_INTRODUCTION_DATE between $P{START_DATE} and $P{END_DATE} AND chre.ON_PROD_INTRODUCTION_DATE between $P{START_DATE} and $P{END_DATE}order by chre.type Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 31, 2009 Share Posted August 31, 2009 Hi, If you don't supply values for your START_DATE and END_DATE parameters, they will be initialized with the current datetime, because of the defaultValueExpression you used for them.So basically, start date and end date will be equal. Let's say current datetime is something like: 2009-08-31 11:33:42 Do you have records in your database in which ON_PROD_INTRODUCTION_DATE is precisely equal to this time?I'm pretty sure you don't, and that's why your report is empty. If you don't like it to be empty when no records correspond to your filter criteria, use whenNoDataType="AllSectionsNoDetail". You might want to use the $!P{} syntax to alter the query in case parameters are missing. You'll need to read more documentation or at least look into the /demo/samples/query samples provided with the JR project package. Thank you,Teodor Link to comment Share on other sites More sharing options...
pawel_r Posted August 31, 2009 Author Share Posted August 31, 2009 thanks a lotthat was sth i haven't thought about 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