Jump to content

keithrbennett

Members
  • Posts

    14
  • Joined

  • Last visited

keithrbennett's Achievements

Apprentice

Apprentice (3/14)

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

Recent Badges

0

Reputation

  1. In case this is useful, I'm pasting here some notes from my wiki regarding where the report data source information is stored. Of course, any corrections and improvements are welcome. ---- iReport Data Source ConfigurationsWhen saving all information required to reproduce a report in iReport, keep in mind that the data source information is not stored in the .jrxml file. This is a good thing, because you may want to be able to read a sample data file (e.g. an XML file) while defining the report but use a Java object at runtime for production. While it is easy to store and pass around a .jrxml file, the report data source is not so easy. It is defined in the ireport.properties file, which is located in the following subdirectory of your home directory: .ireport/3.7.3/config/Preferences/com/jaspersoft Of course, replace 3.7.3 with whatever version of iReport you're using. In the ireport.properties file you'll find the connections specified in connection.1, connection.2, etc. You should be able to copy configurations from one users's properties file to another's. However, filespecs may contain absolute directory names that will need to be modified.
  2. Hi, everyone. I have something like this in the XML file that I'm using as my data source: <reportItems> <reportItem> <fruits> <fruit>apple</fruit> <fruit>orange</fruit> </fruits> </reportItem></reportItems> I'd like to use a Groovy expression to join them into a single string which will be used as the string value of one "Fruits" field: groovy:000> ["apple", "orange"].join(', ') ===> apple, orange This report (actually a subreport) is listing the reportItem's, so the fruits field would be repeated once per reportItem. Is there any way I can do this? Is there an XPath expression that will return a Java or Groovy array or list? Can a field contain an XPath query as part of its expression? Thanks for any help. - Keith Post Edited by keithrbennett at 06/11/2010 23:06 Post Edited by keithrbennett at 06/11/2010 23:07
  3. > In my jrmx file, how can I access field 2 and field 3, having a list of A object. You can't. A's reference to its B is private. See the attached code. Code:File Test.java:import java.util.Arrays;import java.util.List;class A { private B b; private int field1;}class B { private int field2; private int field3;}public class Test { void foo() { List<A> list = Arrays.asList(new A()); A a = list.get(0); int n = a.b.field2; }}>javac Test.javaTest.java:19: b has private access in A int n = a.b.field2; ^Test.java:19: field2 has private access in B int n = a.b.field2; ^2 errors
  4. I'm really new to Jasper, but I've read a couple of books, forum posts, etc., and I don't think this is possible. If you really wanted to save .jrxml files for each of many configuration variations at runtime, I think you might need to parse your original XML file in the Java code into a DOM object, make your changes to the DOM object, and then convert it back to XML and write the file. This is easy in Groovy and JRuby (which you can of course use in the JVM), but I don't know how you'd do it in Java. - Keith
  5. I think you need some more parentheses: $F{academicDegreeType}.equalsIgnoreCase("DOCTORATE") ? (($V{TotalACTUAL_DEGREE_QTY} == null ? new BigDecimal("0.0") : $V{TotalACTUAL_DEGREE_QTY}) + $F{actualDegreeQty}) : $V{TotalACTUAL_DEGREE_QTY} With the ternary operator, you need to make sure that it's clear to the compiler that both of the conditional values are unambiguous. Extra parens never hurt: condition ? (true_expr) : (false_expr) - Keith
  6. I too would not worry about creating the extra data source objects. The memory footprint of the data source is probably quite small -- remember that when you pass its constructor a map, list, etc. you're really only passing a 4 or 8 byte reference. And no additional memory is used for all the class methods, even the nonstatic ones, since they're part of the class object and not the instance. The performance overhead of creating and destroying the object is probably tiny also. - Keith Post Edited by keithrbennett at 06/11/2010 19:38
  7. Just to be sure, are you sure you've removed all references to "groovy" in your .jrxml files, and have no old .jasper files that were created before removing those references? However, I suggest keeping Groovy because it's way more powerful and concise than Java. If you're using Maven, you can use this in your pom.xml file: org.codehaus.groovy groovy-all 1.7.2 I think it should be possible to specify runtime scope (runtime), but when I tried, it didn't work. - Keith
  8. How are you starting your application? If it's not from a shell, it might not be using the same path that the shell has. For example, if you're setting the path in your .bashrc file, and your Java app is launched on anything other than the command line, you might not have javac in the path. I believe the path is a Java System property available at runtime; you could log it and see. One solution is to create a link to your javac file in a directory known to be in the path, such as /usr/bin, as in: sudo ln -s /path/to/my/java/bin/javac /usr/bin/javac - Keith
  9. Can someone provide an updated link for this information? I get a 404 Not Found error when I try to access the link. Thanks, Keith
  10. Marco - I'm just a newbie, but I looked in my .jrxml file produced by iReport and didn't see any XML elements identifying the iReport version, or even that it had been produced by iReport at all. I think it's reasonable for Jasper Reports not to care whether or not its configuration file was produced by any particular tool, but I agree that it would be helpful for it to know and check. This could be cumbersome to implement though, and of course it would not know about any versions created after itself. Maybe even more useful would be to check the content of the XML itself to see if there were any (perceived) errors; then it would catch errors regardless of the way in which the file was created. Could this be done merely by attempting to load the .jrxml file, or there errors that that does not catch? - Keith
  11. I'm very new to iReport, but I answered a similar question at: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=75422 I'll paste an excerpt of the text below in case the link is stripped out by the forum software. I think in your case you'd specify the data source query as "/story" and the report query as "*". - Keith ---- Excerpt: ---- In the data source text field labeled "Create data source using this expression", I specified /outerElementName (where "outerElementName" is whatever your outer element name is). Then in the report query dialog I specified XPath as the query language, and specified * as the query string. I have a subreport with repeating elements. For that one, I got it to work by specifying /outerElementName/repeatingElementName in the data source, and outerElementName/repeatingElementName (notice the absence of the leading slash) for the report query. This worked for me, but I'd be curious to know if there's a better way.
  12. Never mind...I found out that the answer is to insert an additional detail band. I also found out that there is a separate forum for iReport. ;) - Keith
  13. All - I'm very new to iReport and Jasper Reports, so please humor me. ;) I'm designing a report and have more for the detail band than can fit on one page. How can I position components (text fields, for example) so that they will appear on additional pages? I can't see a way to create a new page for a detail band continuation. I inserted a page break, and that started a new page in the output PDF, but it didn't give me any more room to place components. Thanks for any help, Keith
  14. I don't have a specific answer for you, but I'm a beginner too, and I had the same problem. I fixed it by trying different values for the XPath strings for the data source and the report XPath queries. In my case, I had an outer XML element with various different elements inside, but not repeating items. I'm using iReport to design the report. In the data source text field labeled "Create data source using this expression", I specified /outerElementName (where "outerElementName" is whatever your outer element name is). Then in the report query dialog I specified XPath as the query language, and specified * as the query string. I have a subreport with repeating elements. For that one, I got it to work by specifying /outerElementName/repeatingElementName in the data source, and outerElementName/repeatingElementName (notice the absence of the leading slash) for the report query. This worked for me, but I'd be curious to know if there's a better way.
×
×
  • Create New...