From version 4.1
edited by Maurice Gasco
on 2015/10/23 19:12
To version 5.1
edited by Maurice Gasco
on 2015/10/23 19:17
Change comment: There is no comment for this version

Summary

Details

Icon Page properties
Content
... ... @@ -191,99 +191,58 @@
191 191  
192 192  [[image:jsr-deploy3.jpg]]
193 193  
194 -== Génération du rapport ==
194 +== Report processing ==
195 195  
196 -Les rapports peuvent être générés dans une action (sur click puis download du résultat par l'utilisateur), ou dans une opératio, ce qui permet de mettre le résultat en attachement d'un objet et donc de le stocker ou de l'envoyer via un workflow par exemple.
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 197  
198 198  
199 199  
200 -=== Dans une action ===
200 +=== Within an action ===
201 201  
202 -Dans une action, le rapport peut être généré en utilisant une étape de type "Print".
202 +Within an action, the report can be generated by using a step of type "Print".
203 203  
204 204  
205 -Par exemple, essayons d'imprimer un rapport qui contient 2 paratres de type date à saisir par l'utilisateur.
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 206  
207 -Dans cet exemple, nous avons un rapport jrxml qui utilise les 2 paramètres de type java.util.Date: parameter1 et parameter2
208 208  
209 209  
210 -[[image:jsr-deploy4.jpg]]
211 211  
212 212  
213 -==== définition du rapport ====
214 214  
215 -Dans Design / Rapports et graphiques / Rapports Jasper, on crée un nouveau rapport:
216 216  
217 -[[image:jsr-deploy5.jpg]]
218 218  
219 219  
220 -A noter les 2 paramètres qui sont définis : parameter1 et parameter2 et les expressions pour les valeurs (plus d'explications dans la suite)
221 221  
222 -==== définition de l'entité qui va permettre la saisie des paramètres ====
216 +Select the "Printing Type" to "Report" and select your report in the "Report" property.[[image:printstep.jpg]][[image:jsr-deploy11.jpg]]
223 223  
224 -Les 2 paramètres doivent être saisis par l'utilisateur. Pour cela on crée une entitée non persistée.
225 -
226 -[[image:jsr-deploy6.jpg]]
227 -
228 -On lui ajoute 2 propriétés de type date: Param1 et Param2. Dans cet exemple, l'entité a été crée dans le bundle customisations, dont le préfixe est "cust". Le nom complet des propriétés est donc custParam1 et custParam2. D'ou le nom et la syntaxe des expressions des 2 paramètres. A adapter en fonction de vos entités.
229 -
230 -[[image:jsr-deploy6.jpg]]
231 -
232 -
233 -Puis on crée une action testPrint:
234 -
235 -[[image:jsr-deploy8.jpg]]
236 -
237 -
238 -La première étape construit un objet custTestReportParams en mémoire et le stocke dans la variable "params"
239 -
240 -La seconde étape permet la saisie des 2 parametres par l'utilisateur de l'objet stocké dans "params"
241 -[[image:jsr-deploy9.jpg]]
242 -
243 -
244 -La 3ème étape déclache la géneration du rapport. Sa définition est la suivante:
245 -
246 -[[image:jsr-deploy10.jpg]]
247 -
248 -A noter le champs Entrée qui permet de préciser l'objet utilisé pour évaluer les expressions de valeur de paramètre (ici "params").
249 -C'est cet objet qui servira de base au calcul des ${custParam1} défini dans l'objet "JasperReport" et dont les valeurs seront passées à JasperReports comme paramètres du rapport.
250 -
251 -
252 -
253 -Le résultat est alors le suivant:\\
254 -
255 -[[image:jsr-deploy11.jpg]]
256 -
257 257  [[image:jsr-deploy12.jpg]]
258 258  
259 -=== Dans une opération ===
220 +=== Using an Operation script ===
260 260  
261 -Dans une opération, la génération du rapport se fait par du script:
222 +Add a "Script" step to your operation :
262 262  
263 -// retrieve the report
224 +// ~/~/ retrieve the report
264 264   var report = sysReport.Get("402881ff1cbdc5aa011cbde9dfc915ac");
265 - // retrieve the PDF result
226 + // ~/~/ retrieve the PDF result
266 266   var result = report.PrintReport(data);
267 - // set the report as an attachement
228 + // ~/~/ set the report as an attachement
268 268   data.custFile = result.sysData;//
269 269  
270 -Dans cet exemple, le rapport est attaché dans la propriété custFile de l'objet
231 +In the example the report in attached to the custFile property defined as a "File Attachment" type.
271 271  
272 272  
273 -==== Valorisation des paramètres dans l'appel d'opération ====
234 +==== Passing parameters to the report ====
274 274  
275 -Les paramètres peuvent être valorisés de 2 manières:
236 +Parameters value can be passed in 2 ways:
276 276  
277 -* soit en passant un objet en contexte. Les finitions de paramètres seront utilisées et les expressions ${xxxx} seront valorisées par rapport à cet objet.
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
278 278  
279 -// retrieve the PDF result
280 - var result = report.PrintReport(data); // the params are calculated based on 'data'
240 +// var result = report.PrintReport(data); // ~/~/ the params are calculated based on 'data'
281 281  
282 282  
283 -* soit en passant un tableau de paramètres en utilisant un objet avec une notation JSON
284 - // retrieve the PDF result
285 - var params = {
243 +* Using a JSON object
244 +// var params = {
286 286   param1:"test",
287 287   param2:"test2"
288 288   }
289 - var result = JasperReports.Print(report, null, report.rqFormat, params); // the params are in params'
248 + var result = JasperReports.Print(report, null, report.rqFormat, params); // ~/~/ the params are in params'
Icon VoilaCapture25.png
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +57.9 KB
Content Icon
Icon VoilaCapture26.png
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +93.9 KB
Content Icon
Icon jsr-field.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +22.0 KB
Content Icon
Icon jsr-tool.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +3.1 KB
Content Icon
Icon jsr-datasource.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +40.1 KB
Content Icon
Icon jsr-sourceinst.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +20.2 KB
Content Icon
Icon jsr-queryl.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +32.5 KB
Content Icon
Icon jsr-query.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +67.6 KB
Content Icon
Icon jsr-queryfields.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +87.6 KB
Content Icon
Icon jsr-opttitle.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +4.4 KB
Content Icon
Icon jsr-fields.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +4.2 KB
Content Icon
Icon jsr-subreport1.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +31.6 KB
Content Icon
Icon jsr-subreport2.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +35.3 KB
Content Icon
Icon jsr-subreport3.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +27.9 KB
Content Icon
Icon jsr-subreport4.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +31.1 KB
Content Icon
Icon jsr-subreportdir.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +25.7 KB
Content Icon
Icon jsr-subreportdir2.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +20.6 KB
Content Icon
Icon jsr-deploy1.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +67.8 KB
Content Icon
Icon jsr-deploy2.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +16.6 KB
Content Icon
Icon jsr-deploy3.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +46.0 KB
Content Icon
Icon jsr-deploy4.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +101.9 KB
Content Icon
Icon jsr-deploy5.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +32.3 KB
Content Icon
Icon jsr-deploy6.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +28.0 KB
Content Icon
Icon jsr-deploy7.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +23.4 KB
Content Icon
Icon jsr-deploy8.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +36.5 KB
Content Icon
Icon jsr-deploy9.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +15.9 KB
Content Icon
Icon jsr-deploy10.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +39.0 KB
Content Icon
Icon jsr-deploy11.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +15.3 KB
Content Icon
Icon jsr-deploy12.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +18.5 KB
Content Icon
Icon print.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +46.3 KB
Content Icon
Icon printstep.jpg
Size
... ... @@ -1,1 +1,1 @@
1 -0 bytes
1 +31.4 KB
Content Icon
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 9.11.5 - Documentation