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

jmurray

Members
  • Posts

    401
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Downloads

Everything posted by jmurray

  1. Why not just implement multiple textboxes, each displaying the same field, that are shifted horizontally by however many pixels you need? Then it's just a matter of setting the Print When Expression for each to inspect the contents of an indent variable: 1st box: new java.lang.Boolean($V{Indent}.intValue()==0) 2nd box: new java.lang.Boolean($V{Indent}.intValue()==1) 3rd box: new java.lang.Boolean($V{Indent}.intValue()==2) 4th box: new java.lang.Boolean($V{Indent}.intValue()==3) and so on, for as many indents as you need. I know it's naff, but it works.
  2. Can you give a plain english explanation of what the report is supposed to show please?
  3. You would implement it in your source SQL using a UNION query. For example: select * from ( select shipment , flight , travel_from , travel_to , "To: " || travel_to as mygrouping from transports where travel_to is not null UNION select shipment , flight , travel_from , travel_to , "From: " || travel_from as mygrouping from transports where travel_from is not null ) a group by mygrouping order by mygrouping The calculated field "mygrouping" then becomes your main report group
  4. I will send you a sample jrxml file on Monday if you don't have a solution by then.
  5. The number 24 is a primitive "int". JasperReports doesn't deal with primitives, so you will have to cast your primitive int as an Integer. To do this you must specify the expression as: new java.lang.Integer(24) otherwise you'll get a compiler error. For boolean expressions you have to cast to java.lang.Boolean. For example: new java.lang.Boolean($V{PAGE_NUMBER}.intValue()==1) The only exception to this casting rule are Strings. For some unknown reason you can specify a literal string (eg. "A String") in a java.lang.String object and it will be cast correctly at compile time. . Post edited by: jmurray, at: 2007/01/06 08:31
  6. I don't know. Best post you crosstab question in the main forum.
  7. It looks like you haven't set you variable's Calculation Type to Sum
  8. Your Print When Expression is not correctly defined. It should read: new java.lang.Boolean(($V{BACKGROUND}.intValue() % 2)==1) As for the other error it looks like you didn't cast your Initial Value Expression as Integer, but just entered 0. Make sure the expression reads: new java.lang.Integer(0) Post edited by: jmurray, at: 2007/01/04 19:42
  9. Information about the InvocationTargetException can be found in the Exception Summary section of this page: http://java.sun.com/j2se/1.3/docs/api/java/lang/reflect/package-summary.html I am unable to generate the error so cannot offer any help resolving this issue other than suggesting you make sure these files all exist in the lib directory: ireport.jar itext.jar jasperreports.jar jcommon.jar jfreechart.jar tools.jar xalan.jar and that there is only one version of each of them in the lib directory and any other directories specified in the classpath. . Post edited by: jmurray, at: 2007/01/04 04:20
  10. there is a small gotcha with setting the Tick label font/fontsize: your settings won't be applied unless you first set font/fontsize for the Value or Category Label that they are associated with.
  11. Assuming that you group by Customer, you can simply use a summing variable, like this: Code: <variable name="mySum" class="java.lang.Double" resetType="Group" resetGroup="Customer" calculation="Sum"> <variableExpression><![CDATA[new java.lang.Double($F{Purchase}.doubleValue() + $F{Payment}.doubleValue() )]]></variableExpression> <initialValueExpression><![CDATA[new java.lang.Double(0)]]></initialValueExpression> </variable> The TextField Expression for your running sum's textbox will then simply be the variable name (eg. $V{mySum} ) . Post edited by: jmurray, at: 2007/01/04 01:06
  12. BTW, you will receive a compilation warning like this: 4537029 [Thread-57] INFO design.JRJdk13Compiler - Note: myScriptlet.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Â because the scriptlet directly manipulates the parametersMap hashmap. Unfortunately there is no setParametervalue() method available, so the direct manipulation of the hashmap is the only way to get the job done. Post edited by: jmurray, at: 2007/01/03 23:21
  13. You need scriptlet magic. First create a scriptlet to do the value passing. This example takes an Integer variable and sets a String parameter, then returns the String contents of the parameter so it can be displayed in a text field: import net.sf.jasperreports.engine.*;public class myScriptlet extends it.businesslogic.ireport.IReportScriptlet { /* Creates a new instance of JRIreportDefaultScriptlet */ public myScriptlet() { } public String CopyVarToPar(Integer v) throws JRScriptletException { parametersMap.put("myParameter", v.intValue()); Integer p = (Integer)parametersMap.get("myParameter"); return (String)p.toString(); }}[/code]In the LastPageFooter or Summary band you need to define a Text Field with the Textfield Expression set to $P{REPORT_SCRIPTLET}.CopyVarToPar($V{myVariable}) The example above will display the contents of the parameter (which will contain the contents of the variable). If you don't want to display anything then your scriplet need not return anything : import net.sf.jasperreports.engine.*;public class myScriptlet extends it.businesslogic.ireport.IReportScriptlet { /** Creates a new instance of JRIreportDefaultScriptlet */ public myScriptlet() { } String CopyVarToPar(Integer v) throws JRScriptletException { parametersMap.put("myParameter", v.intValue()); return (java.lang.String)(null); }}[/code]You can then set the Text Field to Blank When Null and Remove Line When Blank Post edited by: jmurray, at: 2007/01/04 04:17
  14. You should be able to adapt this solution to achieve what you want: http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=view&id=19530&catid=9
  15. As previously stated you have to add an offset in the Text Field that is set up to display the contents of the variable. Set the Text Field Expression to be "new java.lang.Integer(whatever calculation method you use + 1)" Post edited by: jmurray, at: 2007/01/01 22:22
  16. Having looked at this a bit more the problem is a bit more difficult and the solution posted above does not always work. It seems that the vertical space is released for Group Footers, but not for Column or Page Footers. This appears to be a bug/undesirable behaviour. . Post edited by: jmurray, at: 2007/01/01 22:25
  17. If you've defined it as a variable then your formula should look like this: new java.lang.Boolean($V{NumLines}.intValue() == 2)
  18. You could use a formula to return an empty string after the first page and set each element to Remove When Blank. This only works for text field elements. The formula would be something like: new java.lang.String($V{PAGE_NUMBER}.intValue()==1 ? 'Some text' : '') or new java.lang.String($V{PAGE_NUMBER}.intValue()==1 ? $F{myfieldname} : null) If you have any graphical elements (eg. lines or rectangles) then you are stuck with the footer sized gap because you can't assign a formula like this to them. Post edited by: jmurray, at: 2007/01/01 21:21
  19. Check your report's query is not generating a large cartesian product. Same goes for any sub-reports too. Also check that values passed to and from subreports are actually changing (ie. make sure you haven't set a calling parameter or return variable to a fixed value for testing and forgotten to put them back to what they should be).
  20. Create you new variable ROW_COUNTER as java.lang.Integer with a resetType of "Report", incrementType of "Group" using your group's name for the incrementGroup. The calculation method is "Count". Your variableExpression should be "new java.lang.Integer(1)", and your initialValueExpression will be "new java.lang.Integer(0)". That leaves you with a zero based counter. But you need a 1 based counter, so you have to add an offset in the Text Field that is set up to display the contents of the variable. Set the Text Field Expression to be "new java.lang.Integer($V{ROW_COUNTER}.intValue()+1)" Hope this helps
  21. Set up a new java.lang.Integer variable called BACKGROUND. Set its Calculation Type to DistinctCount, Reset type to None, Increment type to None, Variable Expression to a field that will always contain unique values (eg. $F{PortNumber} ), and an Initial Value Expression of new java.lang.Integer(0). That will give you an auto-incrementing variable. In the Detail section make sure all the existing elements are set to Transparent. Now in the Detail section of your report create a new Static Text box. Size it to cover the full extents of the detail section. If you are using multiple columns size it to the full extent of just one column. Set its background colour to be whatever you want it to be. Put a single space in the Static Text area. To make it toggle on and off you use a Print When expression based on your BACKGROUND variable. Set it to be new java.lang.Boolean(($V{BACKGROUND}.intValue() % 2)==1) Now all you need to do is send it to the back. Under the Format Menu choose the Send to Back option, and your done. Post edited by: jmurray, at: 2006/12/27 22:37
  22. Hmmm... that rendering issue sure does limit the way you can use JasperReports. It's usually best to let the JasperReport engine do the vertical sizing of elements wherever possible. Sorry, but I can't think of a solution or workaround, so it looks like you'll have to wait until they sort out the issue with element sizing when using horizontal fill.
  23. You could also change the font for the "Tick Labels" for the appropriate axis. Select a narrow font (like arial) and/or use a small font size.
  24. Wouldn't it be better to do your grouping and summing within you source query? eg. SELECT CUSTOMER , PRODUCT , UNIT_PRICE , SUM(ORDER_QTY) as QTY , SUM(ORDER_QTY)*UNIT_PRICE as SUBTOTAL FROM CUSTOMER_ORDERS GROUP BY CUSTOMER, PRODUCT, UNIT_PRICE
  25. iReport calculates how much vertical space is left on the page after totalling all of the headers, footers, and the detail section. If the total of all of these sections is greater than the page height then it sets the band height of the band you are editting to the maximum number of pixels that can fit. In your case there is no space left, so you get zero pixels. Check that you don't have your header and footer sections oversized, or try reducing the vertical size of one of them and then set the Detail section's height.
×
×
  • Create New...