Jump to content

Recommended Posts

Posted

Hi,

 

Can I obtain in the main report, the value of a variable calculated in a subreport?

 

If yes, how can I do that?

 

Thank's in advance

  • Replies 14
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

Create a variable for a the 'calculated variable' to be stored into; -> to return to the main report. Remember that the main report must have a variable to store this value as well...

 

Main Report -> $V{sub_return}

Sub Report -> $V{return_main}

$V{return_main} -> $V{calc_var}

 

Make sure that the variables match up in your subreport properties...

 

See the subreports sample...

http://jasperforge.org/sf/wiki/do/viewPage/projects.jasperreports/wiki/Samples

Posted

Ok, thank you very much, but how can I

 

"Make sure that the variables match up in your subreport properties..." ?

 

I do not have experience with JasperReport

Posted

First have the main report window active.

 

Right click on your subreport and choose properties.

 

Go to 'SubReport (other)' tab

 

Below is a tab 'Subreport return values'

 

Make sure that the variable names match each created variable.

 

$V{sub_return} -> Destination Variable

$V{return_main} -> Subreport Variable

 

inside the variable definition of $V{return_main} the variable expression should be $V{calc_var}, which has your calculated value inside it.

 

Once you've done this, you should be able to view the contents of your returned value inside the 'Main' report.(using $V{sub_return})

 

Hope this helps...

Posted

I'm very sorry but I can't obtain the value of the variable.

 

In my subreport, I have 1 variable called "SOLDE" (store the sum) and 1 variable called "SOLDE_RETOUR" (the expression value is $V{SOLDE})

 

Now in my main report in the properties of the subreport I have that (mainReport.jpg).

Posted
size=290]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/sub-bfcbd02ab2d11ed58cd1c61579f1faf5.JPG
Posted

If I do that :

size=289]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/4.JPG

 

I have an error : Variable not found : SOLDE_RETOUR

Posted

Forgive me, I am having problems running iReport...

 

From what I can see:

 

Open main report.

 

Open subreport properties (right click -> subreport(other)

 

Change your return values to match your variable names.

 

FOr example:

 

Change subreport variable from _IMPRIMER_LIBELLE to _SOLDERETOUR

 

I will have to continue testing...iReport giving problems to me now :pinch:

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