return a variable from one subReport to another subReport in Jaspersoft Ireport

I have a main Report in jaspersoft. Inside the main Report I have used two SubReports. Inside one of the subreport i have a variable Total Cash. I have to use this variable Total Cash in my next subReport. Is it possible to pass a variable from one SubReport to another SubReport. If not then how can i pass the variable from the SubReport to the main Report.


-------------Problems Reply------------

You can get a return value from a sub-report to the main-report using the returnValue element. The following code sets the $V{result} value in the main-report to the value of $V{total} in the sub-report. This is much more obvious in iReport instead of jrxml code. Take a look at Subreports for more information.

<subreport isUsingCache="true">
<reportElement x="18" y="11" width="189" height="77" key="subreport-1" />
<returnValue subreportVariable="total" toVariable="result" />
<subreportExpression class="java.lang.String">
<![CDATA["C:/Program Files/JasperSoft/iReport-3.0.0/compile/Untitled_report_2.jasper"]]>

Absolutely you can :

Just set the return value from the first subreport to your desired variable in main report, then on your second subreport pass parameter with the value of your previous variable. But you will get null value if you placed second subreport in a same details band with the first subreport, then try to add more details band and place your second subreport here.

Category:ireport Views:2 Time:2011-12-06

Related post

  • passing parameter from main report to subReport According To Row in JasperSoft iReport 2012-03-20

    Possible Duplicate: JasperReports: How to pass parameter to subReport I have one sub Report inside the main Report. Now I have to pass parameter from the mainReport to the sub Report. I have uploaded an image to make it clear. As shown in the image I

  • How do you return a variable in a C -> ruby interface? 2008-11-19

    A follow up to an earlier question, showing the part that fails when I try to get the error message from my target library: require 'gt4r' @@test_environment = "INCLUDE=C:\\graphtalk\\env\\aiadev\\config\\aiadev.ini" @@normal_user = "BMCHARGUE" descr

  • Returning a variable from a function in php (return not working) 2009-02-04

    I'm building an XML page inside of a function, and for some strange reason I don't get the whole thing spit out of the function. I've tried return $thisXml; } echo $thisXML; and I only get the xml declaration which is in the variable before the funct

  • How to return javascript variable to Ajax? 2009-05-21

    Does anyone know how can I return the javascript variable to ajax instead of string value while I using ajax to call the php. Please see below example for more details: Ajax: //Ajax Param var paramList = "Action=make_process"; ajaxRequest = $.ajax({

  • return the variable used for using inside the using C# 2010-05-12

    I am returning the variable I am creating in a using statement inside the using statement (sounds funny): public DataTable foo () { using (DataTable properties = new DataTable()) { // do something return properties; } } Will this Dispose the properti

  • How do I return a variable from Google Maps JavaScript geocoder callback? 2010-06-07

    I am working with the google maps API and whenever I return the variable to the initialize function from the codeLatLng function it claims undefined. If I print the variable from the codeLatLng it shows up fine. var geocoder; function initialize() {

  • JQuery ajax function works but can't return the variable correctly 2010-06-23

    I have a function runAjax that functions correctly. Unfortunately I am struggling to return the value I get from the ajax query. The ajax function assigns the returned value inside "contents" or "error" xml tags to the variable "result". If I alert t

  • Asynchronous WCF service, how to return any variable 2010-10-20

    public int SendServiceCallFromAnotherClass() { client.SendCompleted += new EventHandler<SendCompletedEventArgs>(client_SendCompleted); client.SendAsync(clientSettings); //i have to return some int here from my service } void client_SendComplete

  • Max and Min Value - Need method to return two variable values 2010-10-30

    I am new to coding and need help understanding what is wrong with my logic and or syntax in the following method... The program is supposed to return the max and min values of an array. My goal was to have two variables (max and min) outside of the m

  • return a variable length string array 2010-11-15

    what's the best method to return a variable length string array --------------Solutions------------- I'd prefer to use a generic collection such as: List<string> (or IList<string>), or IEnumerable<string> depending on how you plan t

  • How to return a variable from a javascript function into html body 2011-01-16

    I am still new to javascript, and I am trying to get a function to return a variable using html & javascript. Basically the function should just return whichever radio button that the user clicks on, although at the moment I don't see anything be

  • returning three variable to function and checking them 2011-03-22

    Hello please help me out regarding returning the variable from the function I am return three variable from the function likw this return $data return $success return $error calling from $check =$user->search($result); now to put some condition ac

  • Returning a variable that is deeply nested in an if else control structure? 2011-05-01

    How would I return a variable that is deeply nested inside an if else structure, for use in another function that alters the program flow from the result of the returned variable in the first function? This is the basic structure of the program, the

  • Dificulty returning a variable via a function 2011-05-07

    I'm trying to return variables as true or false via a function. I want to do it this way so I can call ajax only once, and receive both variables back in one function. However, I'm having trouble returning the variable. Here is my code: var emailExis

  • return string variable from Main() 2011-08-19

    I would like to return a string variable from my Main() method. I've returned int variables. But I'm not sure if it's possible to return a string variable from Main() when you exit the program? Any ideas? Here is my int code: public class Program { /

  • Using Plyr in R with a complex function that returns multiple variable 2011-09-08

    I have a data set with three grouping variables: condition, sub, & delay. Here is a simplified version of my data (real data is much longer) sub condition delay later_value choiceRT later_choice primeRT cue 10 SIZE 10 27 1832 1 888 CHILD 10 PAST

  • javascript does not handle all returned json variables 2011-11-04

    I have a problem with handling json variables in javascript. The problem appears when I try to post data to a php class and then it should return 3 variables using JSON, but Firebug + FirePHP told me that the JSON variable returned correctly. Then wh

  • recommended way to return multiple variables from math-crunching AS3 function? 2011-11-09

    I'm new to Actionscript programming. I'm trying to figure out what is the best way to return multiple variables, each having a different data type, from a function. For example, if a function needs to return variable aa ( a string) and variable bb (a

  • PHP - How to return a variable from a class method? 2011-12-27

    I don't understand the concept of getter and setter methods in PHP, pls help me out. Let's say I have this class: class something() { public function test() { $bla = 10; return $var; } } How do I get the follwing code to work: $something->test();

Copyright (C), All Rights Reserved.

processed in 0.169 (s). 11 q(s)