Jump to content
Changes to the Jaspersoft community edition download ×

Passing fields into a sub report...


2005 IR Help

Recommended Posts

By: Michael Bauer - mbabauer

Passing fields into a sub report...

2004-08-31 11:14

Can anyone help me pass a field to a sub report? I tried the following:

 

<subreport isUsingCache="false">

<reportElement

mode="Opaque"

x="0"

y="89"

width="534"

height="95"

forecolor="#000000"

backcolor="#FFFFFF"

key="subreport-1"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="true"/>

<subreportParameter name="ComputerSysID">

<subreportParameterExpression><![CDATA[$F{EP_HWID}]]></subreportParameterExpression>

</subreportParameter>

<connectionExpression><![CDATA[$P{VUL_SUB_connection}]]></connectionExpression>

<subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{VUL_SUB}]]></subreportExpression>

</subreport>

 

The properties VUL_SUB is a JasperReport object and the VUL_SUB_connection is a java.sql.Connection object. When I pass in the subreport parameter ComputerSysID (its a String), the first thing I do is print it out in the sub report, but it is blank. If I print it out from the master report, using the field ($F{EP_HWID}), the value is there. Any thoughts.

 

 

 

 

 

By: Michael Bauer - mbabauer

RE: Passing fields into a sub report...

2004-08-31 12:10

Some more information:

 

I tried setting a variable to the value of the field, then using the variable, but it also failed the same way. If I hard-code the subreportExpression to a string, say "XXXXXXXX", it works. But, if I have any variable or field in the subreportExpression in any combination, it will not pass in any value.

 

For instance, I tried setting the expression to:

<![CDATA["TEST"]]>

and the sub report printed "TEST", but if I set it to:

<![CDATA["TEST"+$F{EP_HWID}]]>

then the sub report would not print anything at all. The same is true if I remove the string and just try to pass in the field/variable.

 

I also tried creating a parameters map with the fillowing:

<parametersMapExpression><![CDATA[new HashMap().put("ComputerSysID",$F{EP_HWID})]]></parametersMapExpression>

 

This time I get a null value for the printout in the subreport.

 

 

Please, any assistance would be very appreciated.

 

 

 

 

By: Michael Bauer - mbabauer

RE: Passing fields into a sub report...

2004-09-14 08:32

Is no one having this problem? I still have not found a fix for this as of late. Can someone test on their systems using JasperReports 0.6?

 

 

Thanks in advance...

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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