iReport Ultimate Guide - Nimsoft Library
iReport Ultimate Guide - Nimsoft Library iReport Ultimate Guide - Nimsoft Library
iReport Ultimate Guide150
SubreportsCHAPTER 10 SUBREPORTSSubreports represent one of the most advanced features of UR. They enable the design of very complex reportscreated by inserting one or more reports into another report. All the reports have to be created with similar modalities.You have seen that to generate a report you need three things: a Jasper file, a parameters map (it can be empty) to set a valuefor the report parameters, and a data source (or a JDBC connection) that can be empty. In this chapter, I will explain how topass these three objects to the subreport through the parent report and how to create dynamic connections that are able to filterthe records of the subreport based on the parent’s data. Then I will explain how to return information regarding the subreportcreation to the parent report.This chapter has the following sections:• Creating a Subreport• A Step-by-Step Example• Returning Values from a Subreport• Using the Subreport Wizard10.1 Creating a SubreportAs noted previously, a subreport is simply a report composed of its own JRXML source and compiled in a Jasper file.Generally speaking, creating a subreport is very similar to creating any other report. You have to pay attention only to the printmargins, which are usually set to zero for subreports because a subreport is meant to be a portion of a page, not an entiredocument. The horizontal dimension of the subreport should be as large as the element into which it is placed in the parentreport. To insert it, we use a Subreport element (Figure 10-1).151
- Page 99 and 100: 6.1.2 Accessing the SQL Query Desig
- Page 101 and 102: Fields, Parameters, and Variables6.
- Page 103 and 104: 6.2.3 Built-in ParametersFields, Pa
- Page 105 and 106: Fields, Parameters, and VariablesRe
- Page 107 and 108: Fields, Parameters, and Variables6.
- Page 109 and 110: Fields, Parameters, and VariablesTa
- Page 111 and 112: Bands and GroupsCHAPTER 7BANDS AND
- Page 113 and 114: Bands and Groupsexpression may be r
- Page 115 and 116: Bands and GroupsFigure 7-6Dragging
- Page 117 and 118: Bands and GroupsFigure 7-10The firs
- Page 119 and 120: Bands and GroupsFigure 7-14 shows t
- Page 121 and 122: 7.3 Other Group OptionsBands and Gr
- Page 123 and 124: Fonts and StylesCHAPTER 8FONTS AND
- Page 125 and 126: Fonts and StylesThe list of availab
- Page 127 and 128: Fonts and StylesFigure 8-5Font Exte
- Page 129 and 130: Fonts and StylesFigure 8-7Font Exte
- Page 131 and 132: Fonts and StylesFigure 8-10The new
- Page 133 and 134: Fonts and StylesTo apply a style to
- Page 135 and 136: Fonts and StylesFigure 8-17The outl
- Page 137 and 138: TemplatesCHAPTER 9TEMPLATESOne of t
- Page 139 and 140: TemplatesFigure 9-2Columnar reportA
- Page 141 and 142: TemplatesFigure 9-4Group by step in
- Page 143 and 144: TemplatesIf a static text element i
- Page 145 and 146: TemplatesFigure 9-8Your custom temp
- Page 147 and 148: TemplatesFigure 9-10New template in
- Page 149: TemplatesFigure 9-12Preview of repo
- Page 153 and 154: SubreportsFigure 10-3Subreport elem
- Page 155 and 156: SubreportsFigure 10-4Subreport Para
- Page 157 and 158: SubreportsFigure 10-7Just a list of
- Page 159 and 160: SubreportsFigure 10-11 Subreport Wi
- Page 161 and 162: SubreportsFigure 10-14 The final re
- Page 163 and 164: Subreports3. Click the Add button t
- Page 165 and 166: Subreports10.4 Using the Subreport
- Page 167 and 168: SubreportsFigure 10-21 Subreport co
- Page 169 and 170: SubreportsFigure 10-23 Setting Subr
- Page 171 and 172: Data Sources and Query ExecutersCHA
- Page 173 and 174: Data Sources and Query Executers•
- Page 175 and 176: Data Sources and Query ExecutersFig
- Page 177 and 178: Data Sources and Query ExecutersFig
- Page 179 and 180: Data Sources and Query ExecutersFig
- Page 181 and 182: Data Sources and Query ExecutersFig
- Page 183 and 184: Data Sources and Query ExecutersFig
- Page 185 and 186: Data Sources and Query ExecutersFig
- Page 187 and 188: Data Sources and Query Executers•
- Page 189 and 190: Data Sources and Query ExecutersAft
- Page 191 and 192: Data Sources and Query ExecutersIns
- Page 193 and 194: Data Sources and Query Executerspub
- Page 195 and 196: Data Sources and Query ExecutersFig
- Page 197 and 198: Data Sources and Query ExecutersFig
- Page 199 and 200: Data Sources and Query Executersbe
SubreportsCHAPTER 10 SUBREPORTSSubreports represent one of the most advanced features of UR. They enable the design of very complex reportscreated by inserting one or more reports into another report. All the reports have to be created with similar modalities.You have seen that to generate a report you need three things: a Jasper file, a parameters map (it can be empty) to set a valuefor the report parameters, and a data source (or a JDBC connection) that can be empty. In this chapter, I will explain how topass these three objects to the subreport through the parent report and how to create dynamic connections that are able to filterthe records of the subreport based on the parent’s data. Then I will explain how to return information regarding the subreportcreation to the parent report.This chapter has the following sections:• Creating a Subreport• A Step-by-Step Example• Returning Values from a Subreport• Using the Subreport Wizard10.1 Creating a SubreportAs noted previously, a subreport is simply a report composed of its own JRXML source and compiled in a Jasper file.Generally speaking, creating a subreport is very similar to creating any other report. You have to pay attention only to the printmargins, which are usually set to zero for subreports because a subreport is meant to be a portion of a page, not an entiredocument. The horizontal dimension of the subreport should be as large as the element into which it is placed in the parentreport. To insert it, we use a Subreport element (Figure 10-1).151