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

0

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.

 

 

adityasinghcs's picture
Joined: Dec 29 2014 - 11:39pm
Last seen: 3 years 7 months ago
rajesh.sirsikar - 4 years 8 months ago

This link solution doesnot resolve the issue.

The main parameter is still not visible to sub dataset or chart datasetrun while adding paramter into it.

adityasinghcs - 4 years 8 months ago

2 Answers:

0

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.

 

 

adityasinghcs's picture
Joined: Dec 29 2014 - 11:39pm
Last seen: 3 years 7 months ago
0

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:

and report output:

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.

tchen's picture
54030
Joined: Feb 27 2008 - 7:33am
Last seen: 5 days 2 hours ago

I think you can also answer in already present same issues raised by others.

adityasinghcs - 4 years 8 months ago
Feedback
randomness