Working Jasper Report with Date Parameter & Exported to PDF

Hi Guys,

I Just want to share some report parameters & export to pdf on Jasper Reporting using CUBA :slight_smile:

  1. Create Date Parameters on iReport Designer.
    Capture1

  2. Add the Date Parameters on Report Query.
    Capture2

  3. Compile the Report to .jasper.
    Capture3

  4. Create Middleware Service Bean for Report as Service & Add the Report Parameters.
    Capture4

  5. Create Interface for Report Service.
    Capture5

  6. On Report Button Click Method call the Report Service & Pass it as Window Parameter.
    Capture6

  7. On Report Screen get the report output then use it as source for the browserFrame.
    Capture7

Good Luck Guys :slight_smile:

5 Likes

Great help, thanks for your time !

that was very very helpful, i just have a small update, you can dynamically retrieve the parameters from the report JRXML -i have done it before on another non-cuba based application-, will share the code after i actually do it on CUBA.

Great!

Hi @Earl02
Where did you put the jasper files when you deployed the application and did you use any path variable instead of hard-code path?

Please check number 4 picture above check for the string filename :slight_smile: Its being hard coded. You can also use path variable too but on this example i just use hard code.

@Earl02
Want to shed some code snippets on using path variable?

If your using Windows Server you can create system environment variables & use the variable name as its path. Like %temp%, %SystemRoot%.

Also you can use file storage :slight_smile:

https://doc.cuba-platform.com/manual-6.5/images_recipe.html