Jump to content

jmurray

Members
  • Posts

    401
  • Joined

  • Last visited

 Content Type 

Forum

Downloads

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Events

Profiles

Everything posted by jmurray

  1. Do you have a 'Print When' expression set for the disappearing rectangle? If so, is there something wrong with that expression? Is there a transparent rectangle sitting in front of the rectangle with the border and shading? If so, remove it or send it backwards so that the shaded rectangle is visible.
  2. You can do this with a scriptlet. The sample scriplet below accepts an Integer value from the current row and returns the Integer value from the previous row, or zero if you are on the first row. To use it you set your Integer TextField's expression to be $P{REPORT_SCRIPTLET}.getLastValue($F{ProtocolID}) Code:import net.sf.jasperreports.engine.*; public class yourprojectnameScriptlet extends it.businesslogic.ireport.IReportScriptlet { public Integer myLastValue = new java.lang.Integer(0); /** Creates a new instance of JRIreportDefaultScriptlet */ public yourprojectnameScriptlet() { } public Integer getLastValue(Integer nextValue) throws JRScriptletException { Integer i = myLastValue; myLastValue = nextValue; return i; } }Post edited by: jmurray, at: 2007/07/04 23:43
  3. Pattern match using wildcards % and ? select x1,x2 from table where x1 LIKE '$P!{keystring}%' works for Oracle and mySQL for strings, so if you are dealing with number patterns you'll need to convert them to string first. Here's an Oracle example: select x1,x2 from table where TO_CHAR(x1) LIKE TO_CHAR($P{keynumber}) || '%' % substitutes for any number of characters, ? for a single character. . Post edited by: jmurray, at: 2007/07/04 02:25
  4. If you want to pass multiple values to an SQL query then you need to modify the query. Try this: select x1,x2 from table where x1 IN ( $P!{valueList} ) $P{valueList} is a java.lang.String paremeter that contains comma separated values. For strings it would look like "'value1', 'value2', ... " For numbers it would look like "1, 2, 3, 5 ...." Works for Oracle and mySQL. Don't know about other dB types. Note the use of the exclamation mark which suppresses the rabbit ears (") around the string. Note2: Make sure that your parameter contains at least one value, otherwise the SQL will fail with error . Post edited by: jmurray, at: 2007/07/02 22:47
  5. Headers are filled before the detail section is filled, so custom and inbuilt variables relating to a count of records for the current page will be zero. You could build a subreport that contains both the header and details and link it to the main report via the group. The main report's query would probably need to be modified so that it only returns details about the groups (ie. not all the detail).
  6. new SimpleDateFormat("dd/MM/yyyy").format($F{yourdatefield}) or preformat the date as a string in your source query like this oracle example: select to_char(myDateField,'DD/MM/YYYY') as formattedDate ....
  7. Kelly, this should be opened in a new thread. The simple answer is to use simpledateformat: new SimpleDateFormat("dd/MM/yyyy").format($F{yourdatefield}) or preformat the date as a string in your source query like this oracle example: select to_char(myDateField,'DD/MM/YYYY') as formattedDate .... Post edited by: jmurray, at: 2007/07/01 22:07
  8. Ah, that's entirely different. The method java.util.Properties.storeToXML is valid, so it looks like it just can't be found. Double check that: * your classpath is complete and correct * you have the correct jar for the java.util.Properties class (I'm not java savvy but I think you might need rt.jar for java.util.Hashtable class. Maybe someone else can fill you in on this) * you have an import statement included in your report's xml source (eg. <import value="java.util.*" /> ) . Post edited by: jmurray, at: 2007/06/27 22:45
  9. "Ciao are able me say like varibiale contains the total of the pages for behaviour of the thanks test" I'm going to guess that this translates to: "hello, I would like to ask which variable contains the total number of pages in a report so that I can control the behaviour of other report elements. thanks" The variable that contains the number of pages in a report is $V{PAGE_NUMBER}. The TOTAL number of pages in the report is ONLY available once the entire report has been filled. This means that it really cannot be used to control much at all. Here is one example of how to use it from the developers of jasperReports: http://jasperreports.sourceforge.net/tips.tricks.html#pagenumber
  10. OK, so it's clear that each report can have only papersize and one layout (ie. portrait or landscape). So if you want multiple reports to print in a particular sequence then you'll have to do it manually. There is no way to chain reports together that I know of. You could always post a feature request on the developer forge, as it could be a useful solution for some reporting requirements.
  11. This related item may help: http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=view&id=27026&catid=9
  12. The only way you can conditionally control the display of any header based on source data is to use subreports. Subreports are always evaluated first, so you can pass values back to variables in the main report. The subreports would have to be located before the group headers of course, some like in the report header is good. You can set them up to be invisible as you are only interested in the returned values. Please note that subreports will increase the processing time depending on the size of the source data and the complexity of the query.
  13. create a new variable called (say) $V{HighCount) as java.lang.Integer with a Calculation Type of Sum and an Initial Value Expression of new java.lang.Integer(0) The Variable Expression would then be new java.lang.Integer($F{yourFieldName}.equals("High") ? 1 : 0) . Post edited by: jmurray, at: 2007/06/27 01:54
  14. There is an error in your SQL syntax - you need parentheses around your composite OR SELECT TESTIN.TESTNO, TESTIN.SERIALNO, TESTIN.ANALYS, TESTIN.ANALYSEX, TESTIN.MEANVAL FROM TESTIN where testin.testtype='DOCUMENTS' and (testin.analys='SAL' or testin.analys='PAV' or testin.analys='BLANK' or testin.analys='ID' or testin.analys='KLANR' or testin.analys='KLATIP' or testin.analys='KLAAPR' or testin.analys='QUANT') This may fix your problem. Note: you may be able to use IN instead of the composite OR SELECT TESTIN.TESTNO, TESTIN.SERIALNO, TESTIN.ANALYS, TESTIN.ANALYSEX, TESTIN.MEANVAL FROM TESTIN where testin.testtype='DOCUMENTS' and testin.analys in ('SAL', 'PAV', 'BLANK', 'ID', 'KLANR', 'KLATIP', 'KLAAPR', 'QUANT')
  15. In your Chart Properties - Data you have four items that you can set: Series Expression: set to "1" if you only have one data series, otherwise set to a series value (eg. $F{SalesPerson} ) Category Expression: the base value grouping (eg. $F{Month} ). These values are displayed on the category axis. It's a good thing to also set the "Category Axis Label Font" and "Category Axis Tick Label Font" chart properties. I use values of Arial 10 and Arial 5 respectively. Value Expression: the individual values (eg $F{SalesAmount} ). These values are displayed on the value axis. It's a good thing to also set the "Value Axis Label Font" and "Value Axis Tick Label Font" chart properties. I use values of Arial 10 and Arial 5 respectively. Label Expression: The text to display at the end of each bar (eg. new java.lang.Integer(new java.lang.Double($F{SalesAmount}.doubleValue()/1000000).intValue()).toString() + "M" will display sales amounts as millions). Labels are not displayed unless the "Show Labels" chart property is set to true. Also note that there appears to be an issue with the Category Series dialog box. It doesn't seem to update changes all the time. It's often simpler to edit the xml source.
  16. You can choose any name for a database connection as it's just an internal reference within iReport. Once you've selected the correct database driver to use (eg. for Oracle you use the "Database JDBC connection" driver) then it's simply a matter of getting the database connection values correct. For a JDBC connection you select the specific driver type for the database you are using (mySQL, Oracle, sqlServer, etc) first. Then you need to insert the correct IP address or DNS name of the database server, the correct port to use, and the schema/username to use and its password. For Oracle connections you will also need to append the correct SID (as defined in tnsnames.ora) to the JDBC URL Here's a sample JDBC connection definition: Name: PROD JDBC Driver: oracle.jdbc.driver.OracleDriver JDBC URL: jdbc:oracle:thin:@db1.bmi.edu.au:1568:buyers User Name: rpt_user Password: <some password> Note the way the JDBC URL is structured - after the @ sign you have the server address, the port number, and the BUYERS SID. You also need to know if there is a firewall between the database server and the iReports PC/server. If there is a firewall you need to make sure that traffic is allowed to flow between the two devices on the specified port. Post edited by: jmurray, at: 2007/06/27 00:34 Post edited by: jmurray, at: 2007/06/27 00:35
  17. There are a couple of ways to do what you want to do. The simplest way is to define a report group called "SalesPerson" based on the field (say) $F{salesperson}. Each report group has its own counter variable $V{<groupname>_COUNT}. In this example the group counter variable would be call $V{SalesPerson_COUNT}. These group counter variables are available in the group footer, so you can define a java.lang.Integer Text Field that reference $V{SalesPerson_COUNT}. I'll have a look for a tutorial on variables and counters while you play with groups :)
  18. Looks to me like a crosstab would provide a suitable solution...
  19. You're asking for the same thing again! :) It's not like Microsoft Word where you can insert section breaks and reformat each section with whatever page setup you like. You get one canvas for the main report and that's it. If your subreports are a mix of A4 portrait and A4 landscape then your main report would most probably need to be A3 portrait to fit them in. But it wouldn't necessarily look any good.
  20. It is not possible to change the width of the report canvas, so trying to do what you are asking doesn't make sense. Unfortunately it is not possible.
  21. It is impossible to know that a report's last page is currently being filled as the last page cannot be determined until the entire report is rendered (ie. already filled). Remember that the last page moves in relation to the size of the report's content which is largely controlled by the number of rows displayed in the Detail section. You can use a Last Page Footer to display items of interest on the last page. Alternatively you could inject an end of datastream marker into your source data and look for that. eg. This sample query will have 'zzzzzzzzz' as the item value in its last row: select item, cost, tax from orders UNION select 'zzzzzzzzz' as item, 0 as cost, 0 as tax from dual order by item
  22. Are you really sure that what you are seeing is true? Remember that once you place an object using magnetism it will be surrounded by an orange border that sits 2 pixels outside the element's real border. If in doubt, align an object and then inspect its properties and those of the element that it snapped to. Also remember that if the borders of two existing elements are close but not identical then the algorithm will make up its own mind as to which one to snap to, so make sure you align all existing elements first.
  23. You really, really should be using the aggregate functions available in DB2. But enough of my rant. If you have multiple columns that form the key then so be it. Just concatenate them like this in your textfield expression: new java.lang.Double($P{REPORT_SCRIPTLET}.setMyItem($F{1stStringField}+":"+$F{2ndStringField}, $F{someDoubleField}) and the same for the getMyItem.
  24. It doesn't make much sense to rule out the two best methods to achieve what you want to do!! Not to worry, you can implement a scriptlet solution that extends the suggestion made by redwine. It allows you to set and get any number of key/value pairs. Please note that there is a performance trade-off in calculating totals in this manner instead of letting the database engine do the work for you! This example is set up to set a Double value for each unique String key. The setMyItem method returns a the Double value passed in, and getMyItem returns the total of all the values for a given key as a Double. A sample setMyItem textfield expression would be: new java.lang.Double($P{REPORT_SCRIPTLET}.setMyItem($F{someStringField}, $F{someDoubleField}) A sample getMyItem textfield expression would be: new java.lang.Double($P{REPORT_SCRIPTLET}.getMyItem($F{someStringField}) What you pass in is up to you. It could be field, parameter, or variable contents, or even static values. Code:public java.util.Map myItems = new java.util.HashMap(); /** Creates a new instance of JRIreportDefaultScriptlet */ public <yourReportScriptletName>() { } public void initMyItems() throws JRScriptletException { myItems.clear(); } public Double setMyItem(String myKey, Double myValue) throws JRScriptletException { Double x = new java.lang.Double(0); Double p = myValue; if(myKey != null) { if(myItems.containsKey(myKey)) { x = (Double)myItems.get(myKey); p = (java.lang.Double) (p.doubleValue() + x.doubleValue()); myItems.put(myKey, p ); } else { myItems.put(myKey, p); } } return p; } public Double getMyItem(String myKey) throws JRScriptletException { Double p = new java.lang.Double(0); if(myKey != null) { if(myItems.containsKey(myKey)) { p = (Double)myItems.get(myKey); } else { p = new java.lang.Double(-1); } } return p; } . Post edited by: jmurray, at: 2007/06/20 09:43
  25. The new 'magnetic' elements feature is brilliant. It's on by default and basically lets you align elements with the edges of sections or other elements as well as the grid in between those edges. Makes for super fast alignment.
×
×
  • Create New...