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

law

Members
  • Posts

    42
  • 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

Posts posted by law

  1. Here is something I'm trying right now. I think it is possible that the first time the chart attempt to access my array it is undefined and hence I get the error. I'm thinking the syntax below would give the right value as the chart gets created. In "Category Expession" I'm trying now:

    $V{likesDiff}.length >0 ? $V{likesDiff}[likesDiff.length]:0

    So far the error is

    Error filling print... Error evaluating expression :      Source text : $V{likesDiff}.length >0 ? $V{likesDiff}[likesDiff.length]:0

    I'm still hoping to make a chart out of an array.

     

     

     

  2. Hi all,
    I have an array that gets populated in a Scriptlet. I assign the scriptlet's output to a variable in my iReport.
    I had tested the variable/Scriptlet output with both types Long[] and List. I'm getting very similar results:
    the array gets populated, I can see it grow in "Detail" band, then I can view the content of it in the "Summary" band.

    The problem comes when I attempt to set it as a "Category Expresion" in one of iReport charts.
    When the array in a Long[], the error is:
    Error filling print... [Ljava.lang.Long; cannot be cast to java.lang.Comparable

    When the array in a String[], the error is:

    Error filling print... [Ljava.lang.String; cannot be cast to java.lang.Comparable

    When the array is a List, the error is:  
    Error filling print... java.util.ArrayList cannot be cast to java.lang.Comparable

    Class Long & String do implement Comparable. Am I missing a cast? not sure how to pipe the content of an array into an iReport chart. Any clues anyone?



    Post Edited by liw at 08/20/2012 21:53
  3. Hi all,

    I have a small test scriptlet with one method returning a string. I'm not sure how to store the scriptlet in the report or build it.

    Here is what I have in the scriptlet:

    import net.sf.jasperreports.engine.JRDefaultScriptlet;
    import net.sf.jasperreports.engine.JRScriptletException;
    public class TestScriptlet extends JRDefaultScriptlet {
         public String testDescription() throws JRScriptletException
         {
             return "Hi there!";
         }
    }

     

    When I build the scriptlet from a command prompt, I get errors for import statements in the scriptlet:

    TestScriptlet.java:2: error: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.JRDefaultScriptlet;
                                      ^
    TestScriptlet.java:3: error: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.JRScriptletException;
                                      ^
    TestScriptlet.java:5: error: cannot find symbol
    public class TestScriptlet extends JRDefaultScriptlet {
                                       ^
      symbol: class JRDefaultScriptlet
    TestScriptlet.java:6: error: cannot find symbol
     public String testDescription() throws JRScriptletException
                                            ^
      symbol:   class JRScriptletException
      location: class TestScriptlet
    4 errors
     

    If anyone has some experience with this, your help will be much appreciated!



    Post Edited by liw at 08/14/2012 16:48
  4. Hi all, I'm attempting to do this simple concatination routine in the iReport that results in errors on build. In "Variable Experssion" I have this: 

    $V{likesStr}+=$F{likes}+","

    Basically, I want to build a coma separated string of field $F{likes}, then later create an array out of it. I tried criating an array on the fly, directly, but couldn't get it populated correctly, the array was retaining only the very last value out of a set of values. I'm hoping to get my array out of the string I'm attaempting to build. 

    The compiler error is: '(java.lang.String) variable_likesStr.getValue()', is a bad expression as the left hand side of an assignment operator

    Any deailed suggestions will be much appreciated.

     

     

  5. Ok, thank you, I was able to set it to be an array.
    Now when I have it set in Variable Expression to this:
    $V{ls}.add( $F{myfield} )
    I get no errors, but ls is a null when tested in the page summery. I tested Calculation set to Nothing and System, but the array is empty. I even dragged it into the page Detail, still a null.



    Post Edited by liw at 08/10/2012 21:21
  6. Hi cmatthews,

    In the dropdown for "Variable Class" I see options  java.lang.Integer,  java.lang.String, java.util.List. I have the newest iReport version installed. Where would I set java.lang.Integer to be java.lang.Integer[]?

    When I had a variable declared as  java.util.List ls, then setting var Expression to ls.add($F{myNumField}), I'd get an error on attempt to "Preview" the report - ls.add function was not allowed. It seems like a simple thing, but...

  7. Hi all, I wonder if its possible to do the following with the records comming from a sql query:

    say I have a report that has numerical values:

    count 1:   300

    count 2:    289

    count 3:    256

    count 4:   220

    Is it possible to create a variable, an numeric Array that would contain the difference between the numbers? - like that:

    Integer[] arr = new Integer[  300-289,  289-256, 256-220]

    I can imagine this is a variable with execution time "Now", but can it be an array? and if so, how would I set up such a variable?

    Big thanks in advance!

     

     

     

  8. Hi fabioparoni,

    When you have that parameter set properly, you wont be asked to input it while running the main report. That popup only occurs when you run a subreport separetely. My guess is that you created that parameter in the main report, but it should be only created in the subreport, on far left top. In main report, when you select subreport icon, in far right properties area, at the very bottom, you need to also add that parameter to the "Parameters" property.

    I hope this helps.  You should compare what you have to the iReport "Subreports" example.



    Post Edited by liw at 08/03/2012 17:54
  9. Here are steps that I took to make the style on the frame to work:

    For Style: 1) add a style (left panel); 2) add condition to the style 3) add a frame to "Detail" 4) add the style to the frame
    via dropdown. 5) set the frame to "Opaque".
    If the style still doesn't look right, edit it in XML view.

  10. Do you know how to make a subreport? Lets say you do. In this case you'd end up with 2 sql statements. Just an example:

    In main report: SELECT distinct name FROM account order by name                  

    Then in subreport: SELECT id, division FROM user_account where company_name = $P{company_name}      

    If you need more specifics you want to check out the sample called "Subreports" in Help/Samples Directory. But here are few basic steps:

    1) Add subreport icon into the main report. 2) Choose new report.
    3) Put in sql, avoid first time around things like "where fieldName=$p{paramName}" This will need to be set later.
    4) once report exists, create the param, add "where fieldName=$p{paramName}" . Test teh sql with a string expession.
    5) Build subreport, build report. 6) If subreport doesn't show up, make sure that subreport expression contains only report name.

     

  11. Hi all,

    I'm working with the iReport example "Subreports". Its subreport uses a frame with a style set to style1. The notes for the subreport point out that the style is used on the frame, but say nothing about how to get/set that style. If I simple copy their fame or type "style1" into style setting, I get the same error:


    Error filling print... Could not resolve style(s): style1
    net.sf.jasperreports.engine.JRRuntimeException: Could not resolve style(s): style1

    Does anybody know how that works? Thanks in advance!

     

     

     

  12. Hi all, I'm attempting to create a subreport, just as a test to see how it works. Here is what I have:

    In my main report the sql is:

    SELECT distinct name FROM account order by name.

    Then I add the "subreport" icon into the main report.

    My subreport sql is:

    SELECT id, division FROM account where name = $P{name}

    I build both reports and run the main one. For some reason I only see main report data, nothing from sub report. Am'I missing something trivial here?

     

     Found it - had to edit Connection Expression

     

     



    Post Edited by liw at 08/01/2012 23:01



    Post Edited by liw at 08/01/2012 23:02



    Post Edited by liw at 08/01/2012 23:47
  13. Hello,

    I have a variable defined for grouping, used in the group heather. I need to have its "Evaluation Time" to be set to "Now"  to get the right data. But when its set to "Now", the first time the var is printed, the var is null. Is there a way to set it to a difault? Thanks a lot.

  14. Hi all, I downloaded iReport last Friday and looking through example Parameters and Variables. When I run the report, report  is created with the country set as Italy, but the sql for if doesn't spacify "Italy" anywhere. Instead, it has the following:

    select * from orders where shipcountry like $P{Country}

     

    I'm not not seeing where $P{Country} is set as Italy. Any ideas anybody?

  15. Hi all,

    I just installed iReport and while exploaring directories, I found a set of samples in directory \Jaspersoft\iReport-4.6.0\ireport\samples. I'm assuming thsese are examples of few sample reports. I'm hoping I can run them from NetBeans IDE. Does anybody know how to run them/ how to get to them in NetBeans IDE?

     

    Thanks a lot!

×
×
  • Create New...