How to stop crystal report viewer from asking login credentials when opening subreport

The problem is in Crystal Report login info. before showing the report you have to set login info to all tables which are included in main report and their sub reports. You are using Disconnected Datasource Report Show method. so you don’t need to provide login info to report document. your problem is here. report.SetDataSource(ds); … Read more

How to create multiple tables in jasper report using json as a datasource?

The structure will be Main report with query produkList.items that display’s Product Name Subreport in detail band with <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource(“itemList”)]]></dataSourceExpression> to display the item table Subreport in summary band with query produkList.summary.summaryReportDetailList to display the summary table This is the result Below you will find the 3 jrxml producing this result, you need to adjust the … Read more

How to pass main report data source to subreport (JasperReports)?

You can pass datasource via the built-in REPORT_DATA_SOURCE parameter. The example: <subreport> <reportElement x=”261″ y=”25″ width=”200″ height=”100″/> <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + “subreport.jasper”]]></subreportExpression> </subreport> You can create new instance of datasource based on variable, parameter or field. The sample: <variable name=”HeadingsCollection” class=”java.util.Collection” calculation=”System”> <initialValueExpression><![CDATA[new java.util.ArrayList()]]></initialValueExpression> </variable> … <subreport> <reportElement x=”0″ y=”0″ width=”515″ height=”20″/> <subreportParameter name=”ReportTitle”> <subreportParameterExpression><![CDATA[$P{ReportTitle}]]></subreportParameterExpression> </subreportParameter> … Read more