ich_freue_mich Posted February 4, 2015 Share Posted February 4, 2015 Hello, so far we created several stand-alone one page reports. All independent from each other. Now we want to assemble them together in one master report. Being still quite new to Jasper I already figured out:I can assemble 2 reports by putting one as a subreport in the title and another in the summary section - but we got many more, so no soulation. If we put a sequence of sub-reports into the title section, they either overwrite each other (as x=0 and y=0) or you get an error because the end of page is reached after the first subreport => no solutionIf (in 2.) we put a in-between 2 sub-reports, they still overwrite and we can another empty page => no solution We also cannot use the "detail" section: Because the datasource of the master report is empty, it will never display anything If can't use the "noData" section because it has the same problems as in 2.Is there any help on what to do out there? Possibly usng groups? But how? Here is our Master report that behaves as described in 2.): <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.0.1.final using JasperReports Library version 6.0.0 --><!-- 2015-02-04T19:21:41 --><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="Blank_A4_Landscape" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="842" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="a37e5125-a809-4647-b6bf-703c70e34714"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="TDBSYNCPROD.xml"/> <background> <band splitType="Stretch"/> </background> <noData> <band height="595" splitType="Stretch"> <subreport runToBottom="true"> <reportElement key="1" mode="Opaque" x="0" y="0" width="803" height="554" isPrintInFirstWholeBand="true" backcolor="rgba(255, 255, 255, 0.0)" uuid="28128e81-8e7a-4fbb-b93f-3a7e83c8ab47"/> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA["SalesBookingsHistory.jasper"]]></subreportExpression> </subreport> <subreport runToBottom="true"> <reportElement key="2" positionType="Float" mode="Opaque" x="0" y="0" width="803" height="554" isPrintInFirstWholeBand="true" backcolor="rgba(255, 255, 255, 0.0)" uuid="28128e81-8e7a-4fbb-b93f-3a7e83c8ab47"/> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA["DGR_Report_absolut.jasper"]]></subreportExpression> </subreport> </band> </noData></jasperReport>[/code] <?xml version="1.0" encoding="UTF-8"?> Pls keep in mind that we have more 1-page sub-reports to join then there are sections available... I am grateful for any hints! Link to comment Share on other sites More sharing options...
peter.w Posted February 5, 2015 Share Posted February 5, 2015 HiI am assuming you don't need parameters, so in your main report set a connection to the database as normal and pass this to each subreport as the connection.Use this query "SELECT 1 AS dummy" for your master report.Then create a detail band for each subreport.I don't know if it is relevant but in the one I made I fetch a value from each subreport to the main but i dont think this is needed. Link to comment Share on other sites More sharing options...
ich_freue_mich Posted February 5, 2015 Author Share Posted February 5, 2015 Many thanks, Peter,you were right, I presently don't have to pass parameters nor I have to return values from the subreports.So the solution below works works for me (for my Oracle DB) :<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.0.1.final using JasperReports Library version 6.0.0 --><!-- 2015-02-05T14:42:34 --><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="01_MasterDailyReport" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="842" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="a37e5125-a809-4647-b6bf-703c70e34714"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="TDBSYNCPROD.xml"/> <queryString language="SQL"> <![CDATA[sELECT 1 AS DUMMY from DUAL]]> </queryString> <background> <band splitType="Stretch"/> </background> <detail> <band height="595" splitType="Stretch"> <subreport runToBottom="true"> <reportElement key="1" mode="Opaque" x="0" y="0" width="803" height="554" isPrintInFirstWholeBand="true" backcolor="rgba(255, 255, 255, 0.0)" uuid="28128e81-8e7a-4fbb-b93f-3a7e83c8ab47"/> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA["SalesBookingsHistory.jasper"]]></subreportExpression> </subreport> </band> <band height="595" splitType="Stretch"> <subreport runToBottom="true"> <reportElement key="2" positionType="Float" mode="Opaque" x="0" y="0" width="803" height="554" isPrintInFirstWholeBand="true" backcolor="rgba(255, 255, 255, 0.0)" uuid="28128e81-8e7a-4fbb-b93f-3a7e83c8ab47"/> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA["DGR_Report_absolut.jasper"]]></subreportExpression> </subreport> </band> </detail></jasperReport>[/code] 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