pspjasper Posted June 13, 2019 Share Posted June 13, 2019 I'm working with TIBCO Jaspersoft® Studio 6.6.0 and my need is to create a report based on a query listing n parent keys. For each key I need 2 subreports based on 2 different queries both filterd by the parent key.The structure consists in a group based on the key (with pagebreak), in the group I define 2 details and in each detail I add a subreport passing the field key as the corresponding parameters.When only 1 of the 2 subqueries returns some result the report in correct but when both return the results are rendered twice in the sequencedetail1 detail2 detail1 detail2I'm not used to work with the xml source code but I add it below hoping it helps finding the problem/error.Any solution or diffrentapproach will be appreciated. <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.6.0.final--><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="test" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="917f0b13-a12d-4ba1-b9e4-2deaaebf5f2d"><property name="com.jaspersoft.studio.data.sql.tables" value=""/><property name="com.jaspersoft.studio.data.defaultdataadapter" value="Xenia12 Data Adapter "/><parameter name="ID" class="java.lang.String"/><parameter name="KC" class="java.lang.String"/><queryString language="SQL"> <![CDATA[select *from sp_v_ddt_testawhere KEY = $P{ID}and KEY_DELIVERY = nvl( $P{KC} ,KEY_DELIVERY)]]></queryString><field name="KEY" class="java.math.BigDecimal"> <property name="com.jaspersoft.studio.field.label" value="KEY"/></field><group name="KEY_DELIVERY" isStartNewPage="true"> <groupExpression><![CDATA[$F{KEY_DELIVERY}]]></groupExpression> <groupHeader> <band height="30"> <textField> <reportElement x="0" y="0" width="100" height="30" uuid="14944b42-27e2-435b-97f0-0d8657f66ae8"/> <textFieldExpression><![CDATA[$P{ID}]]></textFieldExpression> </textField> <textField> <reportElement x="330" y="0" width="100" height="30" uuid="b0cb4c4b-3543-4eff-933b-09e4ef0e83d2"/> <textFieldExpression><![CDATA[$F{KEY}]]></textFieldExpression> </textField> <textField> <reportElement x="440" y="0" width="100" height="30" uuid="04ef2988-c5d2-442f-b2d3-10078d0f7bea"/> <textFieldExpression><![CDATA[$F{KEY_DELIVERY}]]></textFieldExpression> </textField> </band> </groupHeader></group><background> <band splitType="Stretch"/></background><detail> <band height="70" splitType="Stretch"> <subreport> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="550" height="70" uuid="7430fc99-11e2-4615-ab9c-9e615b4b9c0e"/> <subreportParameter name="ID"> <subreportParameterExpression><![CDATA[$F{KEY}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="KC"> <subreportParameterExpression><![CDATA[$F{KEY_DELIVERY}]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA["test1.jasper"]]></subreportExpression> </subreport> </band> <band height="70"> <subreport> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="550" height="70" uuid="94f18fa4-8331-436d-8c4c-f924febf602b"/> <subreportParameter name="ID"> <subreportParameterExpression><![CDATA[$F{KEY}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="KC"> <subreportParameterExpression><![CDATA[$F{KEY_DELIVERY}]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA["test2.jasper"]]></subreportExpression> </subreport> </band></detail> Link to comment Share on other sites More sharing options...
Filip C. Posted June 15, 2019 Share Posted June 15, 2019 Isn't it correct, if a query returns 2 detail records for 1 group, the detailed band is repetad twice.You'll have to add both sub-reports to the group footer. 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