gids01 Posted July 17, 2007 Posted July 17, 2007 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
codyjasperForge Posted July 17, 2007 Posted July 17, 2007 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
gids01 Posted July 17, 2007 Author Posted July 17, 2007 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
codyjasperForge Posted July 17, 2007 Posted July 17, 2007 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...
gids01 Posted July 18, 2007 Author Posted July 18, 2007 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).
gids01 Posted July 18, 2007 Author Posted July 18, 2007 size=290]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/sub-bfcbd02ab2d11ed58cd1c61579f1faf5.JPG
gids01 Posted July 18, 2007 Author Posted July 18, 2007 and in the main report size=379]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/2.JPG
gids01 Posted July 18, 2007 Author Posted July 18, 2007 size=291]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/3.JPG
codyjasperForge Posted July 18, 2007 Posted July 18, 2007 In the _SOLDECOURANT variable expression, you should have the subreport return variable -> SOLDE_RETOUR Does this make a difference?
gids01 Posted July 18, 2007 Author Posted July 18, 2007 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
codyjasperForge Posted July 18, 2007 Posted July 18, 2007 I am sorry, is there any way that I may see your .jrxml? This would be very helpful to me...
codyjasperForge Posted July 18, 2007 Posted July 18, 2007 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:
codyjasperForge Posted July 18, 2007 Posted July 18, 2007 try reading this: http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=view&id=27569&catid=9
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now