Jump to content
We've recently updated our Privacy Statement, available here ×

Need to pass main report parameter into subdataset query but getting error of parameter nor found.


adityasinghcs

Recommended Posts

Using Jasperserver 6.0 and studio also 6.0

 

I Need to pass main report parameter into subdataset query but getting error of parameter nor found.

 

What I already tried to resolve this but issue not resolved.

1.Creating same subdataset paramter name as main parameter name.

2. Creating new paramter in subdataset and applied default value as main report parameter but this is giving error that paramater is not found.

3. Directly called main parameter in subdataset query but this is also same error and parameter not found.

 

 

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

First of all dont even try to refer from anywhere regarding this issue because you will waste your time.

Please only follow what I am mentioning in this.

1. First of all, all parameters that you send from the main report, have to be declared(and of the same type) in your sub dataset.

2. Select your chart or table and go to its dataset bar, you will find dataset run, parameters and parameter mapping. Select parameters on it.

3. Now add a paramter into the list for this you need to open the paramter option in expression edit and select the parameter from it which you created in Sub Dataset and whose name is same as the parameter name of main report input.

4. Now you have to mention the expression of the paramter for this again go to parameter option and select the paramter which you created in Sub Dataset and whose name is same as the parameter name of main report input.

5. Thats It your work is done.

 jasper1.thumb.jpg.6203a40f3560aed6a2aaa834d25a0efa.jpg

jasper2.jpg.da5b4b7d7536cae7eb758c27953122f7.jpgjasper3(1).jpg.5c4d1bd3cd30a132f2a8ef05f7babd42.jpgjasper4.jpg.a7fef4f93441f5d4d20430e1f4371d2a.jpg

jasper1.thumb.jpg.beb04ecb98e3ba33ed7585e933d8f412.jpg

jasper2.jpg.0f7a7ce9693ca873d98f99910e13f267.jpg

jasper3(1).jpg.b70024df6066d60bbae87439cb0d7193.jpg

jasper4.jpg.2a174b3015d0066bc6da37c80ac8ee17.jpg

Link to comment
Share on other sites

From your last screen shot, it does not look like you have set parm Site_Select2 in the parm expression. See my sample screen shot:

screenshot.thumb.png.203b497a828fe71178c969bc7d61494e.png

and report output:

output(2).thumb.png.e5711c4e61553ddcfd02eae65fb09676.png

Here is the sample report JRXML file that you can review and use to run your test using any PostgreSQL datasource:

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.0.1.final using JasperReports Library version 6.0.0  --><!-- 2015-03-23T16:13:35 --><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"              xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports                                  http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"              name="report for  adityasinghcs"              pageWidth="612" pageHeight="792" columnWidth="555"              leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"              uuid="b22b316e-ee07-4194-a6ce-ce3c5c9958f9">    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="JRSrepo"/>    <subDataset name="Dataset1" uuid="45e55c49-fc9c-4dd5-9849-32cb05dd1c15">        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="JRSrepo"/>        <parameter name="Site_Select" class="java.lang.String"/>        <queryString language="SQL">            <![CDATA[select  $P{Site_Select} as site_select]]>        </queryString>        <field name="site_select" class="java.lang.String"/>    </subDataset>    <parameter name="Site_Select" class="java.lang.String">        <defaultValueExpression><![CDATA["adityasinghcs"]]></defaultValueExpression>    </parameter>    <queryString language="SQL">        <![CDATA[select  $P{Site_Select} as site_select]]>    </queryString>    <field name="site_select" class="java.lang.String"/>    <background>        <band splitType="Stretch"/>    </background>    <title>        <band height="30" splitType="Stretch">            <property name="local_mesure_unitheight" value="pixel"/>            <property name="com.jaspersoft.studio.unit.height" value="px"/>            <textField>                <reportElement x="0" y="0" width="571" height="30" forecolor="#FC0905"                               uuid="0100c6b2-9dbb-4efd-890c-7325ba01a465">                    <property name="local_mesure_unitx" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.x" value="px"/>                    <property name="local_mesure_unity" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.y" value="px"/>                    <property name="local_mesure_unitwidth" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.width" value="px"/>                </reportElement>                <textFieldExpression>                    <![CDATA["Parm 'Site_Select'=+$P{Site_Select}+"]]>                </textFieldExpression>            </textField>        </band>    </title>    <pageHeader>        <band splitType="Stretch">            <property name="local_mesure_unitheight" value="pixel"/>            <property name="com.jaspersoft.studio.unit.height" value="px"/>        </band>    </pageHeader>    <columnHeader>        <band height="30" splitType="Stretch">            <property name="local_mesure_unitheight" value="pixel"/>            <property name="com.jaspersoft.studio.unit.height" value="px"/>            <staticText>                <reportElement x="0" y="0" width="300" height="30"                               uuid="c60370ad-ea54-4753-a666-10a3cd658a2e">                    <property name="local_mesure_unitwidth" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.width" value="px"/>                </reportElement>                <text><![CDATA[site_select]]></text>            </staticText>        </band>    </columnHeader>    <detail>        <band height="30" splitType="Stretch">            <property name="local_mesure_unitheight" value="pixel"/>            <property name="com.jaspersoft.studio.unit.height" value="px"/>            <textField>                <reportElement x="0" y="0" width="300" height="30"                               uuid="c1059c75-fc97-4bcc-ba70-3e92d6b29fbc">                    <property name="local_mesure_unitwidth" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.width" value="px"/>                </reportElement>                <textFieldExpression><![CDATA[$F{site_select}]]></textFieldExpression>            </textField>        </band>    </detail>    <columnFooter>        <band splitType="Stretch">            <property name="local_mesure_unitheight" value="pixel"/>            <property name="com.jaspersoft.studio.unit.height" value="px"/>        </band>    </columnFooter>    <pageFooter>        <band splitType="Stretch">            <property name="local_mesure_unitheight" value="pixel"/>            <property name="com.jaspersoft.studio.unit.height" value="px"/>        </band>    </pageFooter>    <summary>        <band height="300" splitType="Stretch">            <property name="local_mesure_unitheight" value="pixel"/>            <property name="com.jaspersoft.studio.unit.height" value="px"/>            <barChart>                <chart evaluationTime="Report">                    <reportElement x="0" y="0" width="571" height="300"                                   uuid="3c84b6e6-ae21-4571-8bc2-5b4b6cb3f488">                        <property name="local_mesure_unitheight" value="pixel"/>                        <property name="com.jaspersoft.studio.unit.height" value="px"/>                    </reportElement>                    <chartTitle/>                    <chartSubtitle/>                    <chartLegend/>                </chart>                <categoryDataset>                    <dataset>                        <datasetRun subDataset="Dataset1"                                    uuid="1d41e8c5-4084-4297-b16e-8523b3bd420d">                            <datasetParameter name="Site_Select">                                <datasetParameterExpression>                                    <![CDATA[$F{site_select}]]>                                </datasetParameterExpression>                            </datasetParameter>                        </datasetRun>                    </dataset>                    <categorySeries>                        <seriesExpression><![CDATA["SERIES 1"]]></seriesExpression>                        <categoryExpression>                            <![CDATA[$F{site_select}]]>                        </categoryExpression>                        <valueExpression><![CDATA[50]]></valueExpression>                    </categorySeries>                </categoryDataset>                <barPlot>                    <plot/>                    <itemLabel/>                    <categoryAxisFormat>                        <axisFormat/>                    </categoryAxisFormat>                    <valueAxisFormat>                        <axisFormat/>                    </valueAxisFormat>                </barPlot>            </barChart>        </band>    </summary></jasperReport>

 

Hope this hepls.

screenshot.thumb.png.9a88e416e5fe020a3f9b51f8cda09fdd.png

output(2).thumb.png.c7691f6a5d445bc9b66af95c945fcafe.png

Link to comment
Share on other sites

  • 5 years later...

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