Jump to content

Printing 2 or more subreports


juanmanuelsanch

Recommended Posts

hi ! I usually prints subreports on the summary band, the problem is that when I want to print 2 or more subreports they overlap.

Wich is the correct way to do it?

Also I want to print the sub reports depending on a variable, so Im using Print When Expression and the formula Im using is:  new Boolean( $P{detalle}.matches( "checked" ) )==true but dosent seem to work, any idea on how to do it?

Thanks!



Post Edited by juanmanuelsanch at 06/22/2010 18:21
Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

You can put the subreport in detail band and set the property strech with over flow. If u do in this way, you can have more than two sub reports without overlapping.

And for print when expression the comand shld be in this way

new Boolean( $P{detalle}.matches( "checked" ) ))? Boolean.TRUE : Boolean.FALSE

 

Hope this shld help u.

 

Regards,

Indhira P :)

Link to comment
Share on other sites

Also, you should make the first subreport position type 'Fix Relative to Top', and the second (and any others) position type = 'Float'. this allows the 2nd and subsequent sub-reports to float down out of the way of the prior report.

AndyX

Link to comment
Share on other sites

In the detail band of the subreport

, you can physically insert text similar to the code below with a regular text editor if the GUI does not offer the option. I use Jasper Assistant, and that field won't have anything displayed (if I have not previously set it)... until I click on it an it drops down the option.

All the GUIs are currently way behind JR in functionality. The options are: "Relative to Tallest Object", "Relative to Band Height",  and "No stretch"

See code below.

Regards... AndyX

Code:
[code] <detail> <band height="16"> <frame> <reportElement style="RowShader" stretchType="RelativeToTallestObject" mode="Opaque" x="2" y="-1" width="732" height="16" isPrintWhenDetailOverflows="true"/> <box padding="0" topBorder="1Point" topBorderColor="#C0C0C0" leftBorder="None" leftBorderColor="#FFFFFF" bottomBorder="None" bottomBorderColor="#C0C0C0" rightBorder="None" rightBorderColor="#FFFFFF"/>
Link to comment
Share on other sites

Also when trying to print the report by using java I get this error in the Print When Expression:

 

Error: Errors were encountered when compiling report expressions class file:

1. Type mismatch: cannot convert from Boolean to boolean

value = (java.lang.Boolean)(new Boolean( ((java.lang.String)parameter_detalle.getValue()).matches( "checked" ) )? Boolean.TRUE : Boolean.FALSE); //$JR_EXPR_ID=31$

 

When using Ireport everything seems to be fine...

 

Any help is appreciated!

Link to comment
Share on other sites

.matches returns boolean (little b) - the data type, not Boolean (big B) - the class.

You need to use Boolean.valueOf([boolean_value]) to create your new object.

With regard to the paging, you can insert a page break element between your sub reports to get them on separate pages.

 

Ed.

Link to comment
Share on other sites

I dont know but it keeps giving me errors. If I try:

Boolean.valueOf( $P{detalle}.matches( "checked" )? Boolean.TRUE:Boolean.FALSE)

In java I get the following error:

Errors were encountered when compiling report expressions class file: 1. The method valueOf(boolean) in the type Boolean is not applicable for the arguments (Boolean) value = (java.lang.Boolean)(Boolean.valueOf( ((java.lang.String)parameter_detalle.getValue()).matches( "checked" )? Boolean.TRUE:Boolean.FALSE)); //$JR_EXPR_ID=31$ <-----> 2. The method valueOf(boolean) in the type Boolean is not applicable for the arguments (Boolean) value = (java.lang.Boolean)(Boolean.valueOf( ((java.lang.String)parameter_detalle.getValue()).matches( "checked" )?

So how do I tell the subreport to print when a variable is equal to a value?

Thanks!



Post Edited by juanmanuelsanch at 07/11/2010 11:38
Link to comment
Share on other sites

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...