Jump to content
We've recently updated our Privacy Statement, available here ×

spambal2

Members
  • Posts

    5
  • Joined

  • Last visited

spambal2's Achievements

  1. Answering my own question: In order for a variable to be returned by the first subreport before being passed to the second subreport, the 2 subreports need to be put in different bands.
  2. Hello, I removed the "Answered" flag because I have now tested the solution (which previously I assumed would work) and couldn't make it work. The issue I have is that when there are 2 or more subreports on a master report, they seem to all be evaluated at the same time, before the proposed "vTitleHasPrinted" variable had a chance to be evaluated and returned by the first report. So its value is always false when it gets into subreport2. It seems like Jasper is generating the subreports in parallel in different threads, so passing to subreport2 a variable which is the output of subreport1 does not work. The same is true if you have a subreport and then a simple text field which displays the subreport's output variable: the text field is evaluated before the subreport has had a chance to return. This can be fixed in this case by forcing the text field to "Evaluation Time = Band" instead of "=Now'. I guess this makes Jaspersoft evaluate the field only after previous elements on the band have been evaluated. But there is no such parameter on subreports. How can I ensure that a subreport2 is really being fed the output variable of a subreport1? Another thing which I'm having a similar issue with is, I want to show a subreport only if its own output variable is true, I'm using the subreport's "Print when expression" and putting in it a test on a variable returned by the subreport itself. But I'm having the exact same problem: the "print when expression" is evaluated before the subreport has returned its value. Maybe in this specific case it makes more sense as this "print" condition actually determines if the subreport should be evaluated or not, so we can't evalute the subreport and its return value before deciding whether the subreport should be printed. Still if it's at all possible to do it, that would be fantastic. Thank you
  3. Answering my own question. I didn't realize I could load my design into a JasperDesign object. From there I can override anything that I want, including a text field's expression, and then compile this design object into a JasperReport object. My mistake was wanting to modify the report directly instead of the design. Cheers
  4. Hello, In my report, I need to put some placeholders for additional calculations that our client could want to see appear in the PDF. The use case is our report by default shows some account balances on a statement, but the client needs to be able to specify some additional balances that should be shown, and those balances should be 100% configuration by the client. So for example, let's say that in a group footer I have 2 text fields A and B which respectively show the values of 2 balances stored in $V{A} and $V{B}. I'm also adding a third field C in the footer, but I leave its expression empty so by default if won't show any text. The client might want to use this field to show for example the sum of A+B. Or they might want to show A-B or 2*A+2*B, whatever. Now from my Java program where I'm compiling the report to get a JasperReport object, I'm able to locate the JRTextField element which corresponds to C. I'm able to set a few parameters on this object, but I'm not able to set the Expression because the JRExpression object only has getters and no setters. But I need to be able to override the empty expression to for example "$V{A}+$V{B}". Again, I need to be able to do this from Java (I'm using the Library) because the client will not have access to Jaspersoft Studio and this override needs to be done dynamically. How can I do that? Many thanks, Didier
  5. Hello, I am currently implementing a report which needs to look something like this (in a PDF format, not that it matters): STATIC TEXT "SECTION 1 TITLE" [subreport 1 (using DataSet1)] [subreport 2 (using DataSet2)] [subreport 3 (using DataSet3)] STATIC TEXT "SECTION 2 TITLE" [subreport 4 (using DataSet4)] [subreport 5 (using DataSet5)] [subreport 6 (using DataSet6)] The "SECTION 1 TITLE" label needs to be seen in the page header of all the pages of subreports 1/2/3. It's a repeated header for the whole section. There are no page breaks between subreports 1, 2 and 3. Here's where my requirement gets tricky: dataSets 1, 2 and 3 could all be empty so their subreports will be hidden. In that case, Section 1 would be completely empty so I should not show the title "SECTION 1 TITLE" and the section 2 title would be the first one visible. This is what I am struggling to achieve. How do I hide the "SECTION 1 TITLE" label when all of the first 3 datasets are empty? Is there a way to retroactively hide the section 1 title, after the subreports have been evaluated? Thank you, Didier
×
×
  • Create New...