bthale Posted February 21, 2012 Share Posted February 21, 2012 I have a subreport that needs to return a string variable. I need this variable displayed in the Page Header. I have tried evaluation times of Now, Report, and Band, but alwys get null. I have debigged the data and the subreport variable is getting it's value from a field in the subreport. This field is not null.How do I get the correct data back from the subreport. Do I need to have the variable calculation set to something other than nothing? Link to comment Share on other sites More sharing options...
bthale Posted February 24, 2012 Author Share Posted February 24, 2012 Anybody have an idea of how to get this done? I've tried several combinations of settnigs on the variables, but still get nothing back - just prints null. Link to comment Share on other sites More sharing options...
mennei Posted February 27, 2012 Share Posted February 27, 2012 As ireport guide said, If you want to get a value from subreport you need to do those steps:1. In the master report, create a new variable (let’s call it SUBBREPORT_VAR) that is type java.lang.String andcalculation type System.2. Select the subreport element and open the Return Values property dialog by clicking the appropriate ... button.3. Click the Add button to create the new return value; the Add/Modify variable dialog will appear.4. Select a calculated value from the subreport’s variables.5. Next, select a calculation type. If you want a subreport value to be returned as-is, select the type Nothing.Good luck! Link to comment Share on other sites More sharing options...
bthale Posted February 27, 2012 Author Share Posted February 27, 2012 I followed these instruction, but still get null returned. I know the variable is not null in the subreport, because I am displayiing it for debugging purposes. There is also a calculation setting in the dialogs where you define a return variable. I'm not sure if it should be set to System also, but there is no option in the dropdown for System. Is this a bug? Link to comment Share on other sites More sharing options...
bthale Posted February 27, 2012 Author Share Posted February 27, 2012 Also - there is no calcuation, just trying to return a string that is only available in the subreport Link to comment Share on other sites More sharing options...
mennei Posted February 28, 2012 Share Posted February 28, 2012 Ok, I did some tests and this is what I got:If in the subreport variable the "variable experssion" is empty - you will get null.So, all the instration are the same except that in the master report the variable definations are: class="java.lang.String", incrementType="Report", calculation="nothing", resetType="Report"And in the subreport the variable defination are:class="java.lang.String", incrementType="none", calculation="nothing", resetType="none" and the Variable Experssion is not empty.The result that I got was that in the master report I could display the subreport variable.Good luck. Link to comment Share on other sites More sharing options...
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