Menu
Home
Log in / Register
 
Home arrow Computer Science arrow Building Applications with Scala
Source

Creating an image report

Now we will create the image report. We will follow a very similar process to the one we used for the product and review report. As we have an image URL, we will also display the image, so we will need to use a different component. Let's get started on creating an image report:

  • 1. Click on File | New | Jasper Report.
  • 2. Select the Invoice template and click on Next.
  • 3. The file name will be Images.jrxml. Then click on Next.
  • 4. Choose MySQL from Data Adapter and click on Next >.
  • 5. Query(Text) should contain the following code snippet:

Select p.name, i.url from Image i, Product p where p.id = i.product_id;

  • 6. Then click Next >.
  • 7. Select all the fields: name, url , and then click Next >.
  • 8. Let's skip the group by section and click on Next > and then Finish.

Now we will need to remove all labels and fields, as we did for the other reports, and just keep the labels and fields from the data adapter.

We need to add an image component called Image. You can find it in the palette at the right-hand side called Basic Elements. Just drag and drop it into the detail band, as shown in the following screenshot:

Select a custom expression and then type $F{url}.

That's it! Now that we have the image report with images, it's time to change the Play framework application in order to render this report in PDF format over there.

 
Source
Found a mistake? Please highlight the word and press Shift + Enter  
< Prev   CONTENTS   Next >
 
Subjects
Accounting
Business & Finance
Communication
Computer Science
Economics
Education
Engineering
Environment
Geography
Health
History
Language & Literature
Law
Management
Marketing
Mathematics
Political science
Philosophy
Psychology
Religion
Sociology
Travel