iswanlund Posted September 14, 2017 Share Posted September 14, 2017 Hello,I am building a report with a subreport, but keep getting the same error.Pertinent report code: <queryString> <![CDATA[select pofr.id as pofrid, from product_orders_for_reports pofr where pofr.id = 1773589]]> </queryString> <field name="pofrid" class="java.lang.Integer"/> <detail> <band height="671" splitType="Stretch"> <subreport> <reportElement x="40" y="450" width="200" height="200" uuid="04e3d2b5-27e3-4cf8-921c-7471b7bda468"/> <subreportParameter name="POFR_ID"> <subreportParameterExpression><![CDATA[1773589]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA["consumer_subreport.jasper"]]></subreportExpression> </subreport> </band> </detail>Pertinent subreport code: <parameter name="POFR_ID" class="java.lang.Integer"> <defaultValueExpression><![CDATA["1773589"]]></defaultValueExpression> </parameter> <queryString language="SQL"> <![CDATA[select pofr.id from where pofr.id = $P{POFR_ID}]]> </queryString> And the error text:......JRException: Error preparing statement for executing the report query:select....where pofr.id = '?'.......Caused by: .... The column index is out of range: 1, number of columns: 0. Does anyone have an idea why this is happening, and what I can do to fix it?Thanks!EDIT: Also, the subreport runs perfectly fine on its own if the pofr.id is hardcoded, and the report runs fine when no subreport is hooked up. The subreport parameter POFR_ID should take the field variable pofrid from the main report, but I get the same error no matter what is passed into it. Link to comment Share on other sites More sharing options...
sanbez Posted September 15, 2017 Share Posted September 15, 2017 You can't get right answer with uncorrect question.<![CDATA[select pofr.id from where pofr.id = $P{POFR_ID}]]>Where tableName after from? This select can not work.And you wrote: the subreport runs perfectly fine on its own Link to comment Share on other sites More sharing options...
iswanlund Posted September 15, 2017 Author Share Posted September 15, 2017 Hi sanbez, thank you for taking the time to look at this!Actually, in my zeal to delete unnecessary code I removed an inner joininner join product_orders_for_reports pofr Also, when I remove the subreportParameterExpression and try to run the main report with the subreport hardcoded, I get a String Integer error. The main report sans subreport, and the subreport solo, run perfectly. Are these errors related? Link to comment Share on other sites More sharing options...
Solution iswanlund Posted September 15, 2017 Author Solution Share Posted September 15, 2017 The subreport wasn't compiling when I saved edits, so bug fixes weren't registering on the main report. When editing a subreport, and want to see it reflected in the main report, click Project->Build Project for the subreport. 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