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

schaibaa

Members
  • Posts

    22
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by schaibaa

  1. In iReport when you add a parameter you can add a default value. Be careful if you're using earlier version of java that do not support auto boxing. If that's the case, just use java 1.4 syntax to express your initial values.
  2. What is your variable's calculation type? What's the variable's expression? It should be: Calculation: sum Expression: $F{variableUsedForLineSums}
  3. Then you're expression is incorrect. It's just Java, whatever that variable is evaluating, is evaluating to double what you expect it to. If you can't figure it out, and it's ALWAYS double, just divide it by two. I'm not exactly sure how your report is setup, but one thing you may consider trying, is change the variable calculation type to "Sum" and in your variable expression, enter the other variable (the line sum's, or whatever they are). Set the reset type to none, etc. Post edited by: schaibaa, at: 2007/03/15 17:24
  4. Ok, I understand what you mean a bit more now. Create a new variable to only hold the sum. Make it identical to your other one. Varibales do have reset types: None: The Initial Value Expression is always ignored Report: The variable is initialized only once at the beginning of report creation by using the Initial Value Expression Page: The variable is initialized again in each new page Column: The variable is initialized again in each new column (or in each page if the report is composed by only one column) Group: The variable is initialized again in each new group (the group specified in Reset Group) So if you make the reset type to none, and make it sum up all of them, you use that seperate variable you created for your calculations.
  5. There is no way japser can do anything to the reader chosen to open your file. You may be able to close it once printed, but it won't have anything to do with jasper.
  6. org.postgresql.Driver can be found in that jar - jar name != driver name. If the file is in your iReportlib folder, it doesn't have to be on the classpath - allthough it doesn't hurt. Change your url to: Code:jdbc:«»postgresql://~~~~~~~~~~Post edited by: schaibaa, at: 2007/03/15 14:01
  7. To my knowledge iReport only supports the built in formatting. That said, there are several ways to approach the problem. Anything you write in Java on the RHS of an expression can be written in the expression field of iReport. If you know the max digits of your field, you can make a nested set of ternary "if"'s to solve it - albeit ugly, it's only presentation logic. The easier way might be to manipulate the data before it reaches iReport. Not sure what you have access to. As far as the ternary solution, check the length - if it's length is >3, then create a substring and add the " to it. Anyway, there's no quick and easy solution in iReport (that I'm aware of)
  8. Hello, You must seperate yourself from the philosophy that text fields and fields are coupled. In fact, they are completely different. iReport supports building RHS (right hand side) expressions in java, so open the proprties of your text field, go to the text field tab, and you will have access to the expression builder, as well as a simply text box to write your expression. Also, there's no ~reason~ to create a hidden field, simply create a variable that will do your running sum, and total sum - if you I'll provide some psuedo code because I don't know the Java types of the variables you're trying to divide: $V{runningSum}.intValue() / $V{totalSum).intValue() Depending on the Type of your display field, and which JRE you're using, you will have to modify that expression to compile under the version of java you're using.
  9. Bands cannot be resized dynamically - Stretch with overflow will not allow something to cross into another band.
  10. As far as I understand it, iReport will not do this for you - If you wanted to get super techical, you could do two different sets of lables, etc and use print when expressions to know which one to display. For example, print 2_line_address_version when address3 is null print 3_line_address_version when address3 is not null Any way you do it, you'll have some whitespace at the bottom or between address and city. Someone please correct if wrong.
  11. Your issue is obviously with what band your chart is in. I'd definately try some other bands, it can get a little tricky if you have groups setup. As a check, try putting it in the last page footer band, obviously that only gets printed once. If it works, then you know you have a band issue.
  12. I think you could do a better job of explaining your problem, however - from what it sounds like you need to create a group and then set the group to go to a new page when the group changes.
  13. You should buy the documentation, it's worth it - saved me a lot of trouble. Some more info on count: Count will incriment when it reaches any non-null data, therefore you have to use a single line expression to say that if it's NOT equal to your comparison, consider it null. I like using methods that return a boolean, but depending on what JRE you're using, you'll have to choose your own method. If you're returning a boolean on count simply say: $F{ProtocolName}.equals("hello") ? "count me" : null where count me could be literally anything. On the contrary, if you want to count everything that DOES NOT meet that criteria, simply change it to: $F{ProtocolName}.equals("hello") ? null : "count me"
  14. There is a bug within iReport where if you change the border to none in the element properties box, it changes it to NULL and your compiler will return an exception. Open it up in the editor of your choice and change it to "none"
  15. While I can't answer your question directly, I may be able to help with some explanation - sorry if this is knowledge you already have. Reset Type indicates when the variable will be reset to whatever is in the initial value, or null if it is blank. The only difference between reset types "none" and "report" is that if you select "none" the initial value expression will always be ignored. Hope this helps
  16. It appears that you cannot calculate this way because these expresions are attempting to calculate simultaneously, therefore you cannot piggy-back expressions in the same band. The alternative was to re-evaluate these in one varialbe, for example A count variable, reset type is group:city Expression: $F{degree_name}.startsWith( "Master" ) || $F{degree_name}.startsWith( "Ph.D" ) ? "count me" : null etc etc Goodluck!
  17. Hello, I recently purchased your documentation. I'm trying to solve a problem with evaluation times when adding items and was hoping it would help, but I was hoping you might have some more advice. I have a field that comes in as degree_type, and I have a few variables that count to see how many of each degree type come through the query. These are grouped hierarchical, by something like the city that these people live in. Coming from my query is something like: City1|masters City1|masters City1|masters City1|masters City1|Bachelors City1|Bachelors City1|Bachelors City1|Bachelors City1|Bachelors City1|Bachelors City1|Doctorate City1|Doctorate City1|Doctorate City1|Doctorate What I want displayed is: City | Masters | Doctorate | Bachelors | City1 | 4 | 4 | 6 | These are coming through perfectly and grouping by City. When I make a variable that adds the three, I cannot get the calculation to return the correct value. My variable expression is: new Integer($V{masters_count}.intValue() + $V{doctorate_count}.intValue() + $V{postdoc_count}.intValue()) My reset type is group: city, and the evaluation time of my text field is group: city. When I run the report, 0 is returned. If I run the report and just change my expression to: new String($V{masters_count}.toString() + $V{doctorate_count}.toString() + $V{postdoc_count}.toString()) I do get the expected results. Please assist! Thanks in advance
  18. There are several other ways to do it, too. Checkout the Sun BigDecimal javadocs - basically if it doesn't end in a whole number, you have to specify rounding behavior.
  19. Again, I have solved my own problem This works: new Double( $V{male_count}.doubleValue() / $V{row_sum}.doubleValue()) data type issue
  20. Hello! I'm writin a report that has two groups Group 1 Group 2 Within these groups, I'm evaluating lines returned by using a variable, calculation type Count that has criteria Variable1: criteriaone.equals( "m" ) ? "count me" : null Variable2: criteriaone.equals( "f" ) ? "count me" : null Variable3: criteriaone.equals( "n" ) ? "count me" : null Variable4: Variable1 + Variable2 + Variable3 I'd also like to display the following: Variable5: Variable1 / Variable4 Variable6: Variable2 / Variable4 Variable7: Variable3 / Variable4 I can display Variable1 through Variable4 fine, but when I introduce Variable5, I get an error message: Code: ErrorÂfillingÂprint...ÂErrorÂevaluatingÂexpressionÂ:Â ÂÂÂÂSourceÂtextÂ:ÂnewÂFloat(Â$V{male_count}.intValue()Â/Â$V{row_sum}.intValue()) java.lang.ArithmeticException:Â/ÂbyÂzero I have those three condensed to group 1, and displayed in the group 1 header. I have my evaluation time of my text fields all to group1, as well as my variable evaluation time. I've done some code like new String($V{male_count}.toString() + " " + $V{row_sum}.toString()) and get values such as "1 3" so it seems like eval times are ok. Help would be appreciated!
  21. For those that may have this same question: count considers all non-null values, so I was able to solve this by using the expression: $F{gender}.equals( "M" ) ? "count me" : null calculation type is count reset type: group - Color Incriment type: none Evaluation time on the text field: Group - Color
  22. Hello, and thank you in advance. Here's a fake dataset like mine: Color | Town | Country | Gender blue | atown | USA | M blue | atown | USA | F blue | btown | USA | M blue | btown | USA | F blue | btown | USA | F I've created three groups, Color, Town, and Country I want to roll up the data and get a count of how many M and F in the group. I want ireport to display like Color | Town | Country | Males | Females | blue | atown | USA | 1 | 1 | blue | btown | USA | 1 | 2 | I basically want it to do a count* of gender where gender=m and another count* of where gender=f I've created a variable, but I'm not doing it correctly. Could someone help me with my variable expression, calculation type, reset type, incriment type, and also when I add the text field, what should the evaluation time be? Thanks again, -Adam
×
×
  • Create New...