2006 IR Open Dicussion Posted August 27, 2006 Share Posted August 27, 2006 By: Subhashini Sekar - ss161213 Problem when using return variables 2006-07-11 07:17Hi All I have generated reports using iReport tool for my application. For my reports i have used sub reports. In the main report there are certain price fields and i total the value using variables. Similarly corresponding to each row in main report there is a subreport in which also total is calculated.The total value is returned fron the subreport using the subreport return values. The main report total is added along with the returned value from the subreport and the value is displayed. This works fine when both the main and subreport has values. But in a case when a particular main report record does not have any subreport record then the value returned from the subreport is null.Hence in this case the total that is displayed is also null(As null+main report vaue =null) But this should not be the case.In this case i want the main report total alone to displayed. (The total value is calculated only when i set the Expression Time as "Band" instead of Now) For this i tried using Print When Expression so that I can print a different value when the returned value is null. But when i use the return variable in Print When Expression the expression time is always set as "Now" and so i dont get the expected results. So is there anyway i can set the Expression time for the variable used in "Print When Expression" Please do help me Thanks in Advance Archana By: Lucian Chirita - lucianc RE: Problem when using return variables 2006-07-12 00:03"Print When" expressions are always evaluated "Now" (when the band redering starts). There is no possibility (currently) to have delayed evaluation of a printWhen expression. In your case, wouldn't it be simpler to make your expression null-safe, e.g. new Integer($V{Total}.intValue() + ($V{SubreportTotal} == null ? 0 : $V{SubreportTotal}.intValue())) or modify the subreport to return 0 instead of null (using initialValueExpression)? HTH, Lucian By: Subhashini Sekar - ss161213 RE: Problem when using return variables 2006-07-13 05:28Hi Lucian, Thanks a lot for the Help.... The report works fine now... Archana By: Subhashini Sekar - ss161213 RE: Problem when using return variables 2006-07-13 07:26Sorry Again I have again come with another problem in the same report. In this report i am also displaying the grand total of all the details displayed. The variable that is returned from the subreports is $V{tot} So to calculate the total of all the values returned from the subreport i use another variable $V{totFull} of calculation type "Sum" and of variable expression $V{tot}. Even here while calculating totFull the evaluation time is set as "Now". So every time i lose the last value in the sum. Is there any way to overcome it.... Please help. Thanks in Advance Archana By: Lucian Chirita - lucianc RE: Problem when using return variables 2006-07-14 01:55You can sum the values returned from a subreport by using the totFull variable to return the same value from the subreport, specifying that the values should be summed: <returnValue subreportVariable="subreportTotal" toVariable="tot"/> <returnValue subreportVariable="subreportTotal" toVariable="totFull" calculation="Sum"/> Don't forget to set calculation="System" for the totFull variable. HTH, Lucian 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