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

doublep

Members
  • Posts

    22
  • Joined

  • Last visited

doublep's Achievements

Apprentice

Apprentice (3/14)

  • First Post Rare
  • Collaborator Rare
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. Here is a simple JRXML that I created following your suggestion. As I understand it, at least. It is supposed to create output with value of "person" field per line, last line should also contain its own number. However, I get no numbers at all. <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="test" language="groovy" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <field name="person" class="java.lang.String"/> <variable name="numRecords" class="java.lang.Integer" incrementType="Report"> <variableExpression><![CDATA[$V{REPORT_COUNT}]]></variableExpression> </variable> <detail> <band height="15" splitType="Stretch"> <textField> <reportElement x="0" y="0" width="200" height="15"/> <textFieldExpression><![CDATA[$F{person}]]></textFieldExpression> </textField> <textField> <reportElement x="300" y="0" width="200" height="15"> <printWhenExpression><![CDATA[$V{REPORT_COUNT} + 1 == $V{numRecords}]]></printWhenExpression> </reportElement> <textFieldExpression><![CDATA[string.valueOf ($V{REPORT_COUNT})]]></textFieldExpression> </textField> </band> </detail> </jasperReport>
  2. Is it possible to find if the given record is the last one? I could probably compare $V{RECORD_COUNT} with something, but with what? Given that there is <sortField>, JR can re-sort input data on the fly, so it knows total number of records. But how do I find it?
  3. I have an image element that is used to display user-uploaded images. I.e. I have no idea what the image would be like in advance. No matter how I try to scale the element, it looks ugly in some cases. * If I use e.g. 200x200 and default scaling mode (retain shape), there is a lot of unused whitespace above and below landscape fotos, as they are downscaled to something like 200x130. Panorama fotos would be even worse. * If I set dimensions to 200x1 and scaling mode to "real size", it becomes great for landscape. But then portrait fotos take too much space, as they are downscaled to e.g. 200x340 (way too high). If someone uploads a vertical comic strip, it will be even worse. Is there a way to achieve something in between? I.e. so that there is no unused vertical space, yet images are limited in height?
  4. Changed Resolution from Open to Unable to Reproduce Changed Status from New to Closed Changed Assigned User from - to @User_306070 We got to this problem again and it turned out I was wrong, subreports now work in our application with FileResolver. JR works as intended.
  5. In our case a chart is built from a custom data source. As a result, some series can have no data at all. In this case colors can turn to be misleading. For instance: Case 1: Base: 10 20 30 <-- assigned color: yellow Margin: 3 5 8 <-- assigned color: green Total: 13 25 38 <-- assigned color: blue Case 2: Base: 10 20 30 <-- assigned color: yellow Margin: [none] <-- no data, no color assigned Total: 10 20 30 <-- assigned color: green So, green line in the same chart can mean different things depending on incoming data.
  6. Eh, there's a typo. When task is planned, but not started yet (no actual dates), I still want a bar for it shown in "planned" category, but _not_ in "actual" category.
  7. > This planned tasks, do you want to see them or not? Apparently you don't What makes you think so? In such cases I want a bar shown in the "planned" category, but in "actual" category. For tasks with both types of dates set, I want a bar both in "planned" and "actual" categories. > Why is your case any different from theirs? Where there's any lax handling of 'null' or similar values it is "don't show anything". For instance, in various JSF components (which are way more for-the-programmer than JasperReports, I'd say) null means "no text" or "empty collection" or something similar, rather than an NPE.
  8. > What kind of Gantt data is this in which you have both start date and end date null? Planned start/end and actual start/end. Obviously actual dates can be not set for tasks planned in future.
  9. > it's better to let the user know that something's gone wrong. One more point. If you care about error detection, NPE with no message is _not_ a good way to report potential errors. If you absolutely want to keep current behavior, please replace that with sth. like IllegalArgumentException ("start/end dates cannot be null") or sth. like that. Just a random NPE makes me think that JasperReport is buggy rather than something is wrong with my datasource.
  10. > In fact, there is another solution for the period duration: I wouldn't quite call this a solution, rather a workaround. In my case I have non-programmers creating report templates (with some assistance). It would surely help if one didn't have to specify complex expressions in chart datasources. > If both start date and end date are null, this could mean also a serious problem when the task was defined Sure. Or it could be normal behavior of data source. Note that replacing nulls with two identical non-nulls (as in your alternative solution) is not correct at data source end, because at that point you don't know how template will be using the values. If it, for instance, just renders values in a text field, then null is clearly preferable to some arbitrary date. My point is that templates are more for end users, while data source creation is more for programmers. JasperReports already makes templates somewhat permissive, by e.g. using script languages or having "render empty if null" property on text fields.
  11. To clarify, it was something along these lines: A [----] [...] B [--] [.........] If first task in category A was deleted for any reason (my first patch would ignore it if it had null start and/or end date), category B would be drawn before A. This is an important drawback in some cases, that is why second patch doesn't ignore such tasks, but instead uses null duration.
  12. Removing such tasks in any way leads to incorrect task ordering, that's why I created the less-trivial patch. I don't remember details now, but it was sth. like if one series have less tasks than another (because some null tasks got deleted), categories could be wrongly reordered by JFreeChart. I.e., as I understand, filtering will not give nice graphs. Note that the less-trivial chart does *not* ignore tasks with null start/end date. Such tasks are still passed on to JFreeChart, only with null duration.
  13. The same as last patch but with simple fix in logic (|| replaced with && as even one null will give an NPE).
  14. A little less trivial patch uses null task durations explicitly permitted by JFreeChart. This solves problem with incorrect task ordering when task was not added in the first series, but added elsewhere. With this patch tasks are always added, but null start or end date results in null task duration instead of an NPE. Note that JFreeChart is buggy itself (trivial fix suggested in https://sourceforge.net/tracker/?func=detail&atid=115494&aid=2962029&group_id=15494 ). In any case, this patch shifts buggy behavior from JasperReports to JFreeChart. I verified that with both JFreeChart and JasperReports patched, null task start/end date work fine.
  15. This trivial patch works for me.
×
×
  • Create New...