Show last authors
1 == Introduction ==
2
3 The (% style="font-family: sans-serif; font-size: 14px; font-style: normal; line-height: 19.6000003814697px; text-align: start;" %)REQUEA(%%) platform integrates the JasperReports reporting engine.
4
5 This engine allows you to create reports as lists, graphics or detail sheets. These reports can be generated as PDF, stored in the database or sent by email.
6
7 These (% style="font-family: sans-serif; font-size: 14px; font-style: normal; line-height: 19.6000003814697px; text-align: start; background-color: rgb(245, 245, 245);" %)JasperReports (% style="font-size: 14px; background-color: rgb(245, 245, 245);" %)reports are defined as .jrxml file. They are typically created with iReport reports design tool.
8
9 NOTE: iReport documentation is available as a book we recommend [[reading>>http://jasperreports.sourceforge.net/JasperReports-Ultimate-Guide-3.pdf]]:
10
11
12 '' 'Requea provides no support, or assistance with the design of reports iReport / JasperReports' ''.
13
14 Please see the iReport documentation, purchase books published by JasperSoft, or buy service or training iReport / JasperSoft if you need it.
15
16 iReport is an open source tool developed by JasperSoft offers a number of services around its tool. Requea does not provide services around iReport paying nor free.
17
18
19 == Installation ==
20
21
22 NOTE: Versions of iReport / JaspertReports
23 iReport is a tool that evolves pretty quickly. Requea actually provides integration with iReport version 4.0.1.
24
25 Integration is done as a netbeans plugin offering the following features :
26
27 - Dynapage connexion to use HQL queries (DynapageQL) on top of Dynapage model.
28
29 - HTTP / HTTPS connexion allowing the use of a remote serveur.
30
31 To install the Dyanapage plugin:
32
33 * Download Dynapage pglugin here: [[Dynapage IReport plugin>>https://download.requea.com/ireport/com-requea-dynapage-ireport.nbm||rel="__blank"]]
34 * Download iReport 4.0.1 from JasperReports website.
35 * in the Tools / Plugins menu, in the"Downloaded" tab, click on "Add Plugins..." button, select the .nbm file
36 * Then select the plugin and click "Install".
37
38 (((
39 (% class="Apple-style-span" style="line-height: 19px;" %)[[image:VoilaCapture25.png]]
40 )))
41
42
43
44 [[image:VoilaCapture26.png]]
45
46
47
48 == HQL vs SQL ==
49
50 You can choose between 2 query langages for your reports
51
52
53 ==== SQL ====
54
55 '''Pros''':
56
57 * more powerful, more flexible
58
59 '''Cons''':
60
61 * no portability between database engines (Oracle / mySQL / MSSQL)
62 * SQL expressions more complicated
63 * Dynapage Option labels not managed
64 * You need to look into the database to discover table and columns names
65
66 ==== HQL (Hibernate Query Language) ====
67
68 Pros :
69
70 * Works with any database engine
71 * Simpler expressions (specially for joins)
72
73 Cons :
74
75 * Need of the knowledge: documentation available on : [[Documentation Hibernate Query Language on JBoss website>>http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html]]
76 * Data model must include all the relations between objects, you cannot build joins "on the fly". You can only use relations defined by Reference/Component properties
77
78 ==== Conclusion ====
79
80 * Use SQL if it is a single project and you are a SQL expert
81 * Use HQL if you build a product that can be used in various environment
82
83 == Building a connection ==
84
85 Click on the Datasource button in the iReport toolbar
86
87 [[image:jsr-tool.jpg]]
88
89 Click "New" to create your datasource: JDBC for a SQL connection, or "Dynapage Instance" for a HQL based connection
90
91 [[image:jsr-datasource.jpg]]
92
93 [[image:jsr-sourceinst.jpg]]
94
95
96 == Dynapage Query ==
97
98
99 When you are in the report editor(Hit "New" menu to create one), you can enter the query that will populate the report
100
101 [[image:jsr-queryl.jpg]]
102
103 === Query language selection ===
104
105 For Requea Dynapage based HQL, select"Dynapage QL", not "Hibernate Query Language (HQL)"
106
107
108 === Query ===
109
110 Here is a simple query example On the right, a tree view shows the available properties. Note: you need sometimes to modify the query (add / remove a character) for the list to be refreshed
111
112 [[image:jsr-query.jpg||alt="png"]]
113
114 ==== Field selection ====
115
116 [[image:jsr-queryfields.jpg]]
117
118 ==== References / components / extensions ====
119
120 Double click on a cardinality 1 reference and you can pickup properties from the referenced object.
121
122 [[image:jsr-field.jpg]]
123
124 ==== List of values ====
125
126 For property defined with a "List of values", the returned value by default is the value stored in the database. You can "double click" on the field to access on the "title" field. You will then get the corresponding title instead of the value stored in the database.
127
128 [[image:jsr-opttitle.jpg]]
129
130 ==== Using fields ====
131
132 Once you have selected the fields and added them with the "Add selected fields" button, you can use them in your report.
133
134 [[image:jsr-fields.jpg]]
135
136
137 == Subreports ==
138
139 In Jasperreports, sub lists and graphics must be managed as subreports .
140
141 Please read the (% style="font-family: sans-serif; font-size: 14px; font-style: normal; line-height: 19.6000003814697px; text-align: start; background-color: rgb(245, 245, 245);" %)iReport (% style="font-size: 14px; background-color: rgb(245, 245, 245);" %)documentation (JasperSoft) for further help.
142
143 Important things to know are:
144
145 * You need to use the "SUBREPORT_DIR" parameter to manage the subreport directory in order to be ready for the deployment on the Requea server
146 * The connection
147
148 Here are the steps to create a subreport.
149
150 [[image:jsr-subreport1.jpg]]
151
152 [[image:jsr-subreport2.jpg]]
153
154 [[image:jsr-subreport3.jpg]]
155
156 [[image:jsr-subreport4.jpg]]
157
158
159
160 ==== SUBREPORT_DIR ====
161
162 This parameter is mandatory for the reporting engine to find the subreports when running in the Requea platform.
163
164 We advise you to always define this parameter
165
166 Put your local directory where you put your reports in order to test the report in iReport. The value will be automatically overridden when the report will be processed with the Requea platform:
167
168 [[image:jsr-subreportdir.jpg]]
169
170 NOTE: SUBREPORT_DIR is also used for static images ("Image Expression" property):
171
172 [[image:jsr-subreportdir2.jpg]]
173
174 == Deployment on the target Requea plateform ==
175
176 Go to the "Design" tab and click on the "Reports and graphs" menu using the "RequeaDev" login
177
178
179 [[image:jsr-deploy1.jpg]]
180
181 [[image:jsr-deploy2.jpg]]
182
183
184 Fill the mandatory fields:
185
186 * The bundle in which the report will be saved
187 * The format (PDF by default)
188 * Upload in "File" the jrxml file of the main report
189 * Upload in "Support files" subreports jrxml files and static images files
190 * Parameters. Fill the parameters according to your report definition (SUBREPORT_DIR parameter does not need to be defined here). in order to have dynamic values for parameters use the ${xxx} syntax.
191
192 [[image:jsr-deploy3.jpg]]
193
194 == Report processing ==
195
196 Reports can be generated in an action or by an operation script, in order to attach the result to an instance of an entity or to send it using a notification
197
198
199
200 === Within an action ===
201
202 Within an action, the report can be generated by using a step of type "Print".
203
204
205 (% style="font-size: 14px; background-color: rgb(245, 245, 245);" %)Create an action named "print", click "Instance" and add a step of type "Print" (the PDF icon in the toolbar)[[image:print.jpg]]
206
207
208
209
210
211
212
213
214
215
216 Select the "Printing Type" to "Report" and select your report in the "Report" property.[[image:printstep.jpg]][[image:jsr-deploy11.jpg]]
217
218 [[image:jsr-deploy12.jpg]]
219
220 === Using an Operation script ===
221
222 Add a "Script" step to your operation :
223
224 // ~/~/ retrieve the report
225 var report = sysReport.Get("402881ff1cbdc5aa011cbde9dfc915ac");
226 // ~/~/ retrieve the PDF result
227 var result = report.PrintReport(data);
228 // ~/~/ set the report as an attachement
229 data.custFile = result.sysData;//
230
231 In the example the report in attached to the custFile property defined as a "File Attachment" type.
232
233
234 ==== Passing parameters to the report ====
235
236 Parameters value can be passed in 2 ways:
237
238 * Using an entity instance. (% style="font-family: sans-serif; font-size: 14px; font-style: normal; line-height: 19.6000003814697px; text-align: start;" %)${xxxx} (%%)expressions refer to entity properties
239
240 // var result = report.PrintReport(data); // ~/~/ the params are calculated based on 'data'
241
242
243 * Using a JSON object
244 // var params = {
245 param1:"test",
246 param2:"test2"
247 }
248 var result = JasperReports.Print(report, null, report.rqFormat, params); // ~/~/ the params are in params'
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 9.11.5 - Documentation