Jump to content
JasperReports Library 7.0 is now available ×

Problem with subreports


2004 IR Help

Recommended Posts

By: Jen - jjkemp

Problem with subreports

2004-06-30 09:12

I have 2 reports, both work independantly. But, when I put one as a subreport of the other, with the parameter from the main, I receive no data from the subreport. What am I doing wrong?

 

 

 

 

By: Rick Millar - rmillar

RE: Problem with subreports

2004-06-30 09:31

Many things can cause what you describe. For any of us to help you, you will have to give us much more detailed information. At a miminum, you might want to paste your subreport SQL statement and list how you have defined your parameters in the master and subreports. We might be able to help you then. Right now, it is like you are asking, "My car won't start. Why?" :-)

 

 

 

 

 

By: Rick Millar - rmillar

RE: Problem with subreports

2004-06-30 09:33

Make sure you look at this thread as well: https://sourceforge.net/forum/forum.php?thread_id=1099366&forum_id=217623

 

 

 

 

 

By: Jen - jjkemp

RE: Problem with subreports

2004-06-30 10:20

sorry...

my subreport select statement has ...where ibitno = $P{INPART}...

my subreport parameter is defined as a string

my main report subreport expression is "d:/iReport/ireport0.3.1/subreport.jasper"

my main report subreport parameter is INPART with expression $F{MMITNO} which is my selected field in the query

do you need any other information? have any idea what my problem is?

FYI - I couldn't get it to work with 0.2.3 either....

 

 

 

 

 

By: Rick Millar - rmillar

RE: Problem with subreports

2004-06-30 10:53

Two things I see that may be part of the problem:

 

Change expression to be: "d:iReportireport0.3.1subreport.jasper"

 

and add an exclamation point to your parameter reference in your SQL statement as follows:

 

where ibitno = $P!{INPART}...

 

Make these changes and see if that helps.

 

Rick

 

 

 

 

By: Jen - jjkemp

RE: Problem with subreports

2004-06-30 10:58

I did that and the subreport is still blank...

Any other ideas?

 

by the way, why do the slashes have to be back slashes and doubled?

 

 

 

 

By: Rick Millar - rmillar

RE: Problem with subreports

2004-06-30 11:19

I am partly conjecturing on why the slashes need to be backslashes and doubled but here is what I think. The path defined in the expression is an absolute path and thus has to follow the convention of the OS you are using. Since it appears you are using a Windows machine based on the path, I think that back slashes are the convention used for Windows. The reason that they need to be doubled is that the backslash is a reserved character that is used to escape special characters. So you need to use another backslash to escape the backslash in your path expression so that it will be interpreted as a literal.

 

Now regarding why you are still getting a blank subreport. Have you tried setting a default value for $P{INPART) in your subreport and executing the subreport by iteself?

 

Also, have you defined a $P{REPORT_CONNECTION} parameter for the subreport element in your master?

 

Also, in the subreport's view report properties, you may want to go the "More..." tab and select "AllSectionsNoDetail" from the pull down next to "When no data:" This will display the static text and structure of your subreport even if the query returns no data.

 

If you are still having problems, paste a copy of your xml files into the posting for us to view.

 

 

 

 

 

By: Daniel K. - dantest

RE: Problem with subreports

2004-06-30 12:01

If you are using iReport 0.3.1 then your compiled subreport probably doesn't have the .jasper extension.

 

So, compile your subreport, check if the filename is subreport.jasper or just subreport (with no file extension) and adjust your subreport filename accordingly.

 

Something that might give you a clue to the problem is the Command Prompt window that you launched iReport in, it might have some exception trace...

 

 

 

 

By: Jen - jjkemp

RE: Problem with subreports

2004-06-30 12:32

actually, the extension is jrjasper? what is this?

I've tried changing it to this extension, and then I receive an error when compiling the main report.

 

 

 

 

By: Jen - jjkemp

RE: Problem with subreports

2004-06-30 12:36

It's working!!! I didn't have the report connection for the subreport!!!

THANK YOU, THANK YOU, THANK YOU!!!

 

But, now I have another problem....

I have to include 4 different subreports, but they vary in length. Sometimes they are overrlapping now. How do I stop that?

 

 

 

 

 

By: Rick Millar - rmillar

RE: Problem with subreports

2004-06-30 13:59

I'm not sure exactly what you mean by overlapping. However, I'll hazzard a guess that you are defining all your subreport elements in the detail band of your master report. If this is the case, you may want instead to create a group band for each of your subreports and put the respective subreport elements in these group bands. This will separate the display behavior of each subreport.

 

 

 

 

By: Jen - jjkemp

RE: Problem with subreports

2004-07-01 12:12

When I put them each in a group, I get a compilation error saying "... type NMTOKEN must be a name token."

NOW what am I doing wrong?

By the way, I really appreciate all the help!!

 

 

 

 

By: Rick Millar - rmillar

RE: Problem with subreports

2004-07-01 13:13

Not really sure since you didn't include the entire error message. However, one thing to check is the make sure that you don't have spaces in your group names

 

 

 

 

By: Jen - jjkemp

RE: Problem with subreports

2004-07-01 13:40

That was my problem, but now I have another!!! IMAGINE THAT!!! Are you sick of this yet?!?!?

The groups won't extend to the next page... I have 4 groups/subreports and only the first 2 are printing now for only the first part number, because that fills up the page.

Know what I need to change now?

 

 

 

 

 

By: Rick Millar - rmillar

RE: Problem with subreports

2004-07-01 15:25

Sorry, you have run out of credits. Please insert more quarters to continue..... :-)

 

Actually, you have exceeded my level of knowledge, I don't have any ideas for this one. Post your XML and perhaps someone can figure it out.

 

 

 

 

By: Jen - jjkemp

RE: Problem with subreports

2004-07-01 20:10

thanks!!! you've been a great help!!

 

 

 

 

By: David Ender - degc

RE: Problem with subreports

2004-07-01 22:52

Hi,

 

How about nested subreports?

 

I read some posts concerning subreports but I haven't found any description on how to nest subreports.

 

The simple master/detail proposition is working fine.

 

But I have a report (master) that should show a columnHeader with dynamic titles (title_sub) and some lines in the detail band (detail_sub).

 

Compiling works fine, but filling the report just eats up my computer resources (RAM) but shows nothing on the screen. Then I tried to add the detail_sub into the title_sub, so that master and title_sub just had one subreport - same behaviour.

 

Any suggestions? - Thanks in advance

 

David

 

 

 

 

By: David Ender - degc

RE: Problem with subreports

2004-07-02 00:08

Sorry, here's a little correction to my last post:

 

With the following configuration

 

- master has title_sub (placed in column header) and

- title_sub (with fields in column header) has detail_sub (placed in detail band)

 

I get a report showing master and column titles but no detail lines when I run master. But when I run title_sub, I get the column titles AND the detail lines.

 

 

 

 

By: C-Box - c-box

RE: Problem with subreports

2004-07-02 02:16

I use nested SubReports and it works great.

 

I also have put a "dummy-level" of SubReport to print the titles in ColumnHeader and then I depend on a certain fieldValue wich SubReport in Detailband should be used. There I have three possible layouts. Therefor the usage of "nested" SubReports was necessary.

 

So have you put your SubReports DataBase from MasterReport to the firstlevel SubReport and from that to the nested SubReports right? It's not very difficult, if you just think logically (don't mix the Queries to fetch data on lowest SubReport-Level.

 

And with the group-problem of Jen.... well I've 7 SubReports on my MasterReport. One of these also has three nested SubReports within. For each of the TopLevel SubReports I used groups also, to prevent overlapping each other. It works great. Just be aware to set the margins of SubReports to cero and make sure to use the right dimensions (width, height) .. and in your SubReports put your data into Detailband, to get the SubReport streched automatically.

 

hth

C-Box

 

 

 

 

By: David Ender - degc

RE: Problem with subreports

2004-07-03 02:59

Yes, you're right, the margins and dimensions weren't correct.

 

With the correct margins and dimensions it works!

 

David

 

 

 

 

By: Jen - jjkemp

RE: Problem with subreports

2004-07-06 05:31

I still can't get it to go to the next page?!?!??

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...