standup_75 Posted May 8, 2007 Share Posted May 8, 2007 I am sure that my parameter "thisMonth" is set, but why does this not work? Code: <subDataset name="registrants"> <parameter name="thisMonth" isForPrompting="true" class="java.lang.String" /> <queryString> <![CDATA[select to_char(usr.REGISTERED_DATE, 'yyyy') as year, to_char(usr.REGISTERED_DATE, 'mm') as month, count(*) as total from USR_ACCOUNT acc, TOL_USER usr, TOL_ADDRESS address, TOL_ADDRESS deliveryaddress where acc.id=usr.id and acc.ROLES = '|PORTAL|' and usr.ADDRESS = address.ID (+) and usr.DELIVERYADDRESS = deliveryaddress.ID (+) and usr.REGISTERED_DATE <$P{thisMonth} group by to_char(usr.REGISTERED_DATE, 'mm'), to_char(usr.REGISTERED_DATE, 'yyyy') order by to_char(usr.REGISTERED_DATE, 'yyyy'), to_char(usr.REGISTERED_DATE, 'mm') asc]]> </queryString> <field name="year" class="java.lang.String" /> <field name="month" class="java.lang.String" /> <field name="total" class="java.lang.String" /> </subDataset> It only works when I do Code:[code] <subDataset name="registrants"> <parameter name="thisMonth" isForPrompting="true" class="java.lang.String" /> <queryString> <![CDATA[select to_char(usr.REGISTERED_DATE, 'yyyy') as year, to_char(usr.REGISTERED_DATE, 'mm') as month, count(*) as total from USR_ACCOUNT acc, TOL_USER usr, TOL_ADDRESS address, TOL_ADDRESS deliveryaddress where acc.id=usr.id and acc.ROLES = '|PORTAL|' and usr.ADDRESS = address.ID (+) and usr.DELIVERYADDRESS = deliveryaddress.ID (+) and usr.REGISTERED_DATE <to_date('01.04.2007','DD.MM.YYYY') group by to_char(usr.REGISTERED_DATE, 'mm'), to_char(usr.REGISTERED_DATE, 'yyyy') order by to_char(usr.REGISTERED_DATE, 'yyyy'), to_char(usr.REGISTERED_DATE, 'mm') asc]]> </queryString> <field name="year" class="java.lang.String" /> <field name="month" class="java.lang.String" /> <field name="total" class="java.lang.String" /> </subDataset> I actually have this problem in many places, knowing that I am using groups to create multiple reports in one pdf. So I have a main report with the definition of all groups and then as many subreport as I need, and this works fine, only the parameters find not their way through. Although I declare them in the main report like this:Code:[code] <subreportParameter name="thisMonth"> <subreportParameterExpression> <![CDATA[new SimpleDateFormat("dd.MM.yyyy", Locale.ENGLISH).format($P{thisMonth})]]> </subreportParameterExpression> </subreportParameter>thisMonth is also declared in the java part and then as parameter in the main report. Any idea? Link to comment Share on other sites More sharing options...
chill_work Posted May 9, 2007 Share Posted May 9, 2007 Have you tried printing out your parameter to make sure it has what you need? When you say it does not work, do you mean it is blank? If it isn't blank, then make sure that the main report is passing it down to the subreport correctly. I am not sure what the code looks like but I do know when I do this in iReport I have to make sure I set what parameters I want to pass down to the subreport. Calvin Link to comment Share on other sites More sharing options...
standup_75 Posted May 9, 2007 Author Share Posted May 9, 2007 Yes, I can print out $P{thisMonth} in the subreport, but the problem is that it is not taken into account in the subdataset, meaning the subdataset is empty and I obtain an empty graph when using it in this same subreport. Link to comment Share on other sites More sharing options...
lucianc Posted May 9, 2007 Share Posted May 9, 2007 Subdatasets do not automatically receive the report parameter values, you need to explicitly set their values:Code:<subDataset name=".."> <parameter name="thisMonth"/> ...</subDataset>...<datasetRun name=".."> <datasetParameter name="thisMonth"> <datasetParameterExpression>..value for the param..</datasetParameterExpression> </datasetParameter></datasetRun> HTH,Lucian Link to comment Share on other sites More sharing options...
standup_75 Posted May 9, 2007 Author Share Posted May 9, 2007 It works, life is good again!!! 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