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

vinays84

Members
  • Posts

    88
  • 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 vinays84

  1. Post the DDL: the names and data type of the columns in your table...specifically the one which you are trying to access.
  2. Please post the DB table DDL and query you are using. Also specify the DB and verify that the DB actually contains the proper data (run the query outside of iReport) to ensure that it is iReport's JDBC access that is the problem.
  3. if $F{Field} is of type String, you should look at the java.lang.String API. http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html It as ample methods available to handle exactly what you are suggesting.
  4. Create another series and set the value expression equal to the sum of the other two value expressions.
  5. The reason this is occurring is because you are summing up a value that is a sum. As a result, you are summing the sum at each step. For example, if your first variable was v1 and the variable second v2, which summed of v1, you'd have: v1 v2 0 0 2 2 2 4 7 11 ------- 0 11 1 12 -------- 0 12 3 15 Where the "--"'s represent new groups. As you can see v2 finishes off at 15 rather than your desired result of 11. The direct solution is the one you suggested yourself, to create the second variable with the same variable expression as the first, but with a reset type of report. If this doesn't work due to your complex definition of the first variable, please post this complex expression, as we can't troubleshoot it blind.
  6. Yes, create a styles You can set conditions on the style to apply different fonts, colors whatever based on an expression. Then simply set the field's style to the one you created.
  7. What do you mean you calculate totalTotal? It's a field, not a variable. You're best bet is to define another variable (say totalAll) with the same expression as that below. Then calculate your percentages by using new Double( ($V{totalMonthlyFees}.doubleValue()*100 ) / $V{totalAll}.doubleValue())
  8. As you have it now, your calculation for the variable perMonthlyFees, which occurs in the column footer, will occur after all the rows have been processed. Thus, Code:new Double( ($V{totalMonthlyFees}.doubleValue()*100 ) / $F{totalTotal}.doubleValue()) will use the last value of totalTotal (the value in the last row of the column totalTotal). I doubt this is what you want. I really have no idea how totalTotal is calculated or should be calculated, as it is specific to your query.
  9. Sounds like you've got your variables and fields mixed up or incorrectly designed. Are you sure totalTotal isn't the variable? If you want a solution to your problem, you have to post code. Post the variable definition(s) and the report SQL.
  10. What does one value of the DB column look like? That means the value of that column for only one row.
  11. Use a variable, set it to be a counting variable. Also set the reset type to be group and set the group to be the one that you have previously defined.
  12. Does anyone know what the Link Parameters feature for hyperlinks does? I've tried playing around with it and see no results (I export to HTML). What I really want to do is add listeners to my hyperlink element (onmouseover, onmouseout). Has anyone had any success in accomplishing this? Thanks!
  13. if you want to use myField in $P!{Parameter}, Parameter should be a String with a value like "(2,4,7)". If you want to keep Parameter as a Collection, use $X(IN, myField, Parameter) Also, make sure you have the latest version of iReport and JasperReports, as the $X feature isn't available in some of the earlier ones.
  14. Yes, there are are several ways you could accomplish this. A simple, but tedious way, would be to create three parameters: query1, query2, and mainquery. Set the default value for query1 and query2 as the valid query and other query respectively. Then set the default value for mainquery as Code:$P(valid).equals("true"«»)?$P(query1):$P(query2)and set your report query as only $P!(mainquery) This is kinda ugly, though, as you have to put the SQL for the two queries in String format. I would suggest a another method: Set your report query as Code:[code] (put first query here) AND $P(valid)='true' UNION (put second query here) AND $P(valid)!='true' This will only work, however, if the two queries have the same types in their selects (# of column and datatypes for each column) but I would assume they would if the report is designed to handle either situation the same. In both methods, I'm assuming $P(valid) is a String which will be set to "true" or "false" based on your checkbox.
  15. In your report, right click in the document structure window and click add then parameters. Name the parameters as you wish and set their class type to be java.util.Date. These will now be filled when you call jasperprint. Your query can access them by using, for example, WHERE table.datefield BETWEEN $P{date1} and $P{date2} if your parameters were named 'date1' and 'date2'.
  16. $V{totalPurchase} and $V{totalProduction} are both Double objects and you can't add two objects. You could use for grandTotal: Code: new Double( $V{totalPurchase}.doubleValue()+$V{totalProduction}.doubleValue() ) However, I would suggest using the BigDecimal class instead of Double, as it has arithmetic methods built in and also solves some Double representation problems. If you changed all they variables class types to BigDecimal, your code for grandTotal would be: Code:[code]V{totalPurchase}.add(V{totalProduction})
  17. For the former, I'm sorry, I provided you with the wrong syntax. It should be $X{IN, <column>, <param>}, so: Code:WHERE $X{IN,PATIENT_NO, testCollection} For the latter, the parameter type must be String. So your backend java code would be: Code:[code] String testCollection = "22222"; testCollection += ",2223322"; testCollection += ",22224562"; This would all you to properly use Code:[code]WHERE PATIENT_NO IN ($P!{testCollection})
  18. If the parameter you pass in is of type collection, then you need to use $X{IN, param}. So if you have a parameter called testCollection of type Collection, your SQL would be: Code:... WHERE PATIENT_NO $X{IN, testCollection} ... Alternatively, you can use Strings for everything and hard put the SQL. So if you had a parameter called testCollection of type String to which you pass in the value "22222,2223322,22224562", your SQL would be Code:[code]... WHERE PATIENT_NO IN ($P!{testCollection}) ...
  19. You need to supply an instance of MathContext. There are some static ones provided for you which will probably serve your needs. Use Code: $V{Margin_Sum}.round( java.math.MathContext.DECIMAL32 ); DECIMAL64, and DECIMAL128 are also available (refer to the MathContext API at http://java.sun.com/j2se/1.5.0/docs/api/java/math/MathContext.html for more detail. These all have HALF_EVEN rounding. This is normal rounding except that .5's are rounded to the even number instead of up. To supply a different rounding scheme, you could try Code:[code] $V{Margin_Sum}.round( new java.math.MathContext(7,java.math.RoundingMode.HALF_UP) ); or however you wish.
  20. Post code..there's no way to troubleshoot without seeing exactly what you're working with.
  21. If the fields which sums these totals are of date format, the time can be calculated by using Date.getTime(), which will return the time in milliseconds, which you can use to calculate whatever time you like and display accordingly.
  22. Use a parameter for the query entitled "Sql" (It has has to match up to the name attribute in the map). For your report query, simply put $P!{Sql}.
  23. I think subdatasets can only be used for charts (and maybe crosstabs). Unfortunately, it cannot be used for the report, you'll have to use a subreport instead.
×
×
  • Create New...