Hi , This is my second blog on jasper report. I will tell you that How to create a dynmic jrxml file using dynamic jasper.
In my previous blog I have discussed integration of jasper report in grails.
For using Dynamic jasper we need two jar file, DynamicJasper-4.0.3.jar and DynamicJasper-4.0.3-tests.jar. You need to import it in your lib file.
Note: Before download these jar file you need to check the compatibility with jasper-report version.
I am using jasper-report-4.7.1 which is compatible with these jar files of dynamic jasper.
For generating jrxml file firstly we need to create its design.
We have two option to generate its design.
1. Using FastReportBuilder
2. Using JasperDesign

As in comparison of both design tool I prefer jasperDesign because it gave me same procedure to develop my code as we create from Ireport tool. When I try to write this code using groovy , I faced some problem because of “$” sign. So I wrote this code in java file. I made a file suppose designUsingJasperDesign.java.
Here are follwing syntax for designing.

Now here is code to make jrxml file from jasperDesign.

Once jrxml file generate , you can use for download your file in any format(e.g: pdf,). For download file using grails you can follow this link.