How to correctly refer to subreports and how to name their ReportUnit name

0

Hi,

Jasper Server Version: 6.4.2

I'm trying to work with subreports in the jasper server, at my first test a simple report with one subreport (Generic Header which I share to all the others reports), it works. I'll explain how I did it work, because I'm in doubt if I did correctly:

1. I publish the subreport as a reportUnit in repo:/reports/

2. In the other report, I put the expression in the subreport component: "repo:/reports/Cabecalho_Landscape_files/main_jrxml" and when I publish this report I Overwrite the Expression passing the same expression.

It works, the generic report could be accessed by all the other reports.

But now I have a report with the same generic header as subreport and it have other subreport where I show some data, but it also have the same generic header.

Report Example 2 Tree:

- Main Report

  1. Generic Header (Subreport)
  2. Summary (Subreport)
    1. Generic Header (Subreport)

When I publish this Main Report, Jasper Server identify 3 resources, but doesn't have any hint ou description about them. All of them are main.jrxml and I can't identify.

This is how Jasper identify resourcers: https://imgur.com/a/S2NAm

Is there a better way to work with subreports in Jasper Server?

Thanks in advance

gui.bernardi09's picture
Joined: Mar 13 2018 - 8:22am
Last seen: 5 months 3 weeks ago

Are you not using Jasper Studio to edit the reports ? 

Using jasper studio would allow you to visually see the subreport layout and modify it

reportdev - 1 year 6 months ago

1 Answer:

0

I will explain my way.

  1. Create subreport in local project as a normal jrxml file.

  2. Create a repository jrxml resource in your subreport's location.

  3. Import from jrxml file create at 1to repository jrxml resource create at 2

  4. Create your Report Unit

  5. Copy repository jrxml resource and Paste as link in your Report Unit. This insert a link with the same name as resource(without folders).

  6. Insert subreport component from Palette in your Report Unit

  7. Select subreport element -> Properties -> Subreport -> Expression and set with the value :  "repo:NAME_OF_THE_LINK_TO_JRXML"

No matter where repository jrxml resource are, with the link and using "repo:....." works well.

I had much troubles with subreports, since I use this way it's very easy.

Mariano

 

mlopez_1's picture
909
Joined: Oct 21 2013 - 8:08am
Last seen: 1 week 2 days ago
Feedback