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

Pass a field from a subreport to a subreport


wkwjsrjehenr
Go to solution Solved by rodrigo_43,

Recommended Posts

Main report 

<subreport>
                <reportElement stretchType="RelativeToTallestObject" x="24" y="10" width="548" height="623" uuid="198e6ba0-fa45-47af-8d87-2325efd48899"/>
                <subreportParameter name="p_s_hostname">
                    <subreportParameterExpression><![CDATA[$P{p_s_hostname}]]></subreportParameterExpression>
                </subreportParameter>
                <dataSourceExpression><![CDATA[$P{p_l_resultTypeTwo}]]></dataSourceExpression>
                <subreportExpression><![CDATA["report/result_sub.jasper"]]></subreportExpression>
 </subreport>

 

 

Subreport 

  <subreport>
                    <reportElement x="20" y="10" width="509" height="70" uuid="440f2f73-a20a-4738-860e-b4078f7edeab"/>
                    <subreportParameter name="p_s_hostname">
                        <subreportParameterExpression><![CDATA[$F{commentList}]]></subreportParameterExpression>
                    </subreportParameter>
                    <subreportExpression><![CDATA["report/comment.jasper"]]></subreportExpression>
</subreport>

JAVA

List <DataMap> list = isptResultService.selectResultTypeOneForReport(param);

        for (int i = 0; i < list.size(); i++) {
            DataMap map = list.get(i);

            List<DataMap> itemResultList = isptResultService.selectIsptItemResultList(map);
            map.put("itemResultList", itemResultList);
          
            List<DataMap> commentList = isptResultService.selectIsptCommentListForReport(map);
            for(int j = 0; j<commentList.size(); j++) {
            commentList.get(j).put("P_S_HOSTNAME", ConfigUtils.getString("SYSTEM.SITE.ADDR"));
            }
            map.put("commentList", new JRBeanCollectionDataSource(commentList));
        }
        model.addAttribute("p_l_resultTypeTwo", new JRBeanCollectionDataSource(list));

In the main report, I used a field variable declaration to pass a parameter to a subreport.

 

I want to send a commentList from a subreport to a subreport.

but net.sf.jasperreports.engine.fill.JRFillSubreport - Fill 2: exception

In the main report, there is a value of p_l_resultTypeTwo.

In the main report, there is no value for commentList.

What is the problem?

 

 

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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