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

gr4nt4

Members
  • Posts

    28
  • 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 gr4nt4

  1. I have an SQL that returns null values but the chart fails to compile due to a 'nul pointer Exception' so I've used the code

    $F{PRODUCTDESC}==null?"":$F{PRODUCTDESC}

    However this now produces an legend segment that has no description in (see graphic)

    I'm looking to do one of the below:

    1. Remove the single segment from the legend

    2.Change the segment color to white and the segment border to white

    3. Have the chart compile correctly even with a nul value.

  2. Hi All

     

    I have two text fields both set to stretchWithOverFlow and have identical settings (used copy & paste) located in the title band. Each one uses parameter that contains a string

     

    Text field 1 example of expression data 50217,50218,50219,50220,50221,50222,50223 up to 400

     

    Text field 2 example of expression data

    6281, 6283, 6285, 6286, 6287, 6288, 6289 up to 100

     

    when run within the IDE both perform as expected and both expand down to fill with the correct info,

     

    text 1 in IDE

     

    text 2 in IDE

     

     

    however when run on the server only one performs as expected the second expands sideways causing all the other text fields to expand to the same width

     

    Text 1 on server

     

     

    text 2 on server

     

     

     

    I tried placing the text fiels in a frame as per one suggestion but still the same.

     

    any thoughts please

  3. Hi All

     

    I have two text fields both set to stretchWithOverFlow and have identical settings (used copy & paste) located in the title band. Each one uses parameter that contains a string

     

    Text field 1 example of expression data 50217,50218,50219,50220,50221,50222,50223 up to 400

     

    Text field 2 example of expression data

    6281, 6283, 6285, 6286, 6287, 6288, 6289 up to 100

     

    when run within the IDE both perform as expected and both expand down to fill with the correct info,

     

    text 1 in IDE

     

    text 2 in IDE

     

     

    however when run on the server only one performs as expected the second expands sideways causing all the other text fields to expand to the same width

     

    Text 1 on server

     

     

    text 2 on server

     

     

     

    I tried placing the text fiels in a frame as per one suggestion but still the same.

     

    any thoughts please

  4. Hi All

     

    I passing in a parameter that is used to switch between sub reports I have been able to achieve this in ireports IDE but when run on the server it does not switch correctly

     

    code used to switch the sub report in the sub reports expression

     

    $P{DeviceTypeID}=="1"?$R{rpt.sub.subname1}: $R{rpt.sub.subname2) + ".jasper"

     

    any thoughts?

  5. I'm trying to create a report as follows

    1-Store1 statistics(group by store)
    3-----Store 1 device1(group by device)

    1-Store2 statistics (group by store)
    2-- Store 2 order summary of devices 1 & 2(group by store)
    3-----Store 2 device 1 orders(group by device)
    3-----Store 2 device 2 orders(group by device)


    I can get stats by store (1) fine and the device level fine (3) but cannot get (2)

    Is it posible to have two groups using the same expression ie 1 & 2 are both by store.

    I've tried a subreport for the order summary (2) but it extends the processing time and report size plus I cannot get it not to print when the store only has 1 device even though I can get a count of devices from a variable and use the "print when expression"

    any help sugestions?

    [file name=SubDetail.jrxml size=31965]

  6. Hi

    I have 4 devices in 2 locations and I'm trying to summarise as follows


    Averages for location 1 (device 1&2)
    Totals of device 1&2
    Total of Device 1
    Total of device 2


    Averages for location 2 (device 3&4)
    Totals of device 3&4
    Total of Device 3
    Total of device 4


    I have grouped by location and device and get


    Averages for location 1 (device 1&2)

    Total of Device 1
    Total of device 2


    Averages for location 1 (device 1&2)

    Total of Device 1
    Total of device 2


    but cannot figure out how to get the
    Totals of device 3&4



    Should it be posible with groups or will I have to use a sub report?



    many thanks [file name=Image1.jpg size=16591]
    Post edited by: gr4nt4, at: 2008/03/18 10:05

  7. Hi

     

    I have 4 devices in 2 locations and I'm trying to summarise as follows

     

     

    Averages for location 1 (device 1&2)

    Totals of device 1&2

    Total of Device 1

    Total of device 2

     

     

    Averages for location 2 (device 3&4)

    Totals of device 3&4

    Total of Device 3

    Total of device 4

     

     

    I have grouped by location and device and get

     

     

    Averages for location 1 (device 1&2)

     

    Total of Device 1

    Total of device 2

     

     

    Averages for location 1 (device 1&2)

     

    Total of Device 1

    Total of device 2

     

     

    but cannot figure out how to get the

    Totals of device 3&4

     

     

     

    Should it be posible with groups or will I have to use a sub report?

     

     

     

    many thanks

  8. Hi all

     

    Using 'Print When Expression' I'm looking to do two things

     

    1. When a field value is above a certain value .. do not print ie somthing like

     

     

    $F{myVal} <=100 then print value else do not print

     

     

    2.Always hide a field

     

    I tried Boolean (true) but an error

     

    as you may guess I'm not a java man

     

    Thanks for the help

  9. HI

     

    My reports are emailed out on a scheduled basis but currently only in English. I need to be able to pass in a parameter that will set the report locale before its mailed out.

     

    Any ideas on how I could achieve this?

     

    Thanks in advance

  10. HI

     

    My application emails out reports on a scheduled basis but currently only in English. I need to be able to pass in a parameter that will set the report locale before its mailed out.

     

    Any ideas on how I could achieve this?

     

    Thanks in advance

  11. Hi folks

     

    I have the following error message and believe I have somthing missing from the classpath. I can produce any reports without a chart but anything with a chart produces the same error.

     

    I have included

     

    commons-beanutils-1.7.jar

    commons-collections-2.1.jar

    commons-digester-1.7.jar

    commons-logging-1.0.2.jar

    itext-1.3.1.jar

    jfreechart-1.0.0.jar

     

    any help greatfully accepted.

     

     

     

    Exception in thread "main" java.lang.NoClassDefFoundError: org/jfree/util/Public

    Cloneable

    at java.lang.ClassLoader.defineClass1(Native Method)

    at java.lang.ClassLoader.defineClass(Unknown Source)

    at java.security.SecureClassLoader.defineClass(Unknown Source)

    at java.net.URLClassLoader.defineClass(Unknown Source)

    at java.net.URLClassLoader.access$000(Unknown Source)

    at java.net.URLClassLoader$1.run(Unknown

  12. Hi All

     

    I've have the following code (which is not mine) which should be able to create pdf and xl output from a command line.

     

    Code:
    /**
    * This module will allow Jasper Reports, desinged via iReport, to be executed
    * in batch mode.
    * The module takes the following arguments:
    * 1) Run Mode - (V)iew Report, (F)ormat Report or (B«»)oth
    * 2) Report Name (Full Path)
    * 3) Output File Name (Full Path) Suffixc is used as File Format
    * (PDF, Excel ...etc)
    * *) The database connection strings are set using the -D (sets the
    * properties dbase.x (driver, url,user, password)
    * Also, the promptable paramaters can now be placed on the command
    * line - so typically the args become
    * [V|F|B] [Full Report Path] [Full Output Formatted Report Name]
    * [-DParamName1=Paramvalue -DParamName2=ParamValue ...etc]
    * ...Be wary here as the ParamNames need to have embedded spaces replaced
    * with ^ (as space in a -D property appears to mess up) - so to pass
    * a parameter of This Is The First Number and This Is The Last Number
    * you would enter:
    * -DThis^Is^The^First^Number=1 -DThis^Is^The^Last^Number=999
    * The reason for doing this is that it means the reports can be run
    * completely unattended. IE, assume that you have a report that is to
    * be scheduled to run every day with the first day of the month (but can
    * have any date passed to it). typically the report would be designed to
    * have a parameter of date that is promptable, but in reality you just
    * want to schedule it to run with a 'calculated' date. So a run script
    * can be set up that calculates the first day of the month, and then
    * passes that as a -D property to this runner - this runner will detect
    * that the date parameter has been passed on the command line, and will
    * not try to prompt for it. So you can have unattended running of
    * 'parameterised' reports.


    // Include the main Jasper Reports Driver.....
    import net.sf.jasperreports.engine.*;
    import net.sf.jasperreports.view.*;
    import java.sql.*;
    import java.util.*;
    import java.text.*;
    import javax.swing.*;

    public class JReportRunner {

    public static void main(String[] args) {
    int i = 0;

    String sourceFileName = null;
    JasperReport compiledReport = null;
    JRParameter[] prompts = null;
    String reportPath = null;
    String outputFileName = null;
    String outputFormat = null;
    String runMode = null;
    Map parameters = new HashMap();
    OpenDatabase openDatabase = null;
    JasperPrint outputReport = null;
    String commandLineParamName = null;
    String paramName = null;
    Class paramClass = null;
    String paramClassName = null;
    String paramValue = null;
    int paramInt = 0;
    long paramLong = 0;
    short paramShort = 0;
    double paramDouble = 0;
    float paramFloat = 0;
    byte paramByte = 0;
    boolean commandLine = false;
    java.util.Date paramDate = null;
    DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);

    // By default date entry is lenient - that means the 0/0/01 is valid
    // as is 99/99/9999 - the days get mapped to existing days ie - 0 in
    // a day is the last day of the preceding month and 99 would be the
    // date in circa 3 months time ..... (why would anyone want
    // that? - anyway, that's how it does it) - so make sure lenient is
    // turned off
    dateFormat.setLenient(false);

    System.out.println("In Runner With Date Format ("+dateFormat+"«»)"«»);
    while (i < args.length) {
    System.out.print("Arg ("+i+"«») Is ("+args+"«») "«»);
    // Move the arguments into named variables
    if (i == 0) {
    runMode = args;
    }
    if (i == 1) {
    reportPath = args;
    }
    if (i == 2) {
    outputFileName = args;
    }
    i++;
    }
    System.out.println();

    // Split the outputfile name to get the suffix - as we'll use this
    // to decide which methods to use to export the file....
    i = outputFileName.lastIndexOf("."«»);
    outputFormat = outputFileName.substring(i+1,outputFileName.length());

    // We need to know the parameters in the report, I can't see any other
    // way of getting to this info apart from 'dummy' compiling the report
    // - but to do that we'll need a pointer to the source .jrxml file
    i = reportPath.lastIndexOf("."«»);
    sourceFileName = reportPath.substring(0,i+1)+"jrxml";

    try {
    compiledReport = JasperCompileManager.compileReport(sourceFileName);
    }
    catch (JRException e) {
    System.err.println("JReportRunner: Cannot Compile Report ("+
    sourceFileName+"«») "+e);
    }

    prompts = compiledReport.getParameters();

    // Now we need to loop through the paramaters and prompt (if promptable)
    // for the values - we'll put the parameters into a separate hash map
    // The prog can also be run with the parameters passed on the command
    // line (via -D) - to enable a true batch process......
    JFrame jframe = new JFrame("Dialog"«»);
    for (i = 0;i < prompts.length;i++) {
    if (!prompts.isSystemDefined()) {
    paramName = prompts.getName();
    // If passed on the command line, the parameter has spaces
    // replaced with ^, so From Claim No becomes From^Claim^No
    // (as spaces messes up the System Properties) - so create
    // a command line parameter from the main parameter, with ^
    // instead of embedded space.......
    commandLineParamName= paramName.trim();
    commandLineParamName= commandLineParamName.replaceAll(" ","^"«»);
    paramClass = prompts.getValueClass();
    paramClassName = prompts.getValueClassName();
    commandLine = false;
    while (true) {
    if (commandLine) {
    // can't do owt else apart from abort here, as we're
    // in 'unattended' mode (in theory)
    System.err.println(
    "JReportRunner: Command Line Parameter ("+
    paramName+"«») Failed Validationn"+
    "Value Set To ("+paramValue+"«»)"«»);
    System.exit(1);
    }
    paramValue = (System.getProperty(commandLineParamName));
    if (paramValue == null) {
    paramValue =
    JOptionPane.showInputDialog
    (jframe,
    "Please Enter Value For "+
    paramName+" n "+paramClass,
    paramName+" (Type "+paramClassName+"«»)",
    JOptionPane.QUESTION_MESSAGE);
    }
    else {
    // This will be detected at the start of the loop,
    // and if set means that a command line parameter
    // failed validation - so we'll have to abort
    commandLine = true;
    }
    if (paramClassName.endsWith("Integer"«»)) {
    try {
    paramInt = Integer.parseInt(paramValue);
    }
    catch (NumberFormatException e) {
    if (!commandLine){
    JOptionPane.showMessageDialog
    (jframe,
    "Invalid Input ("+
    paramValue+"«») "+e,
    "Invalid Integer Value",
    JOptionPane.ERROR_MESSAGE);
    }
    continue;
    }
    parameters.put(paramName,new Integer(paramInt));
    }
    if (paramClassName.endsWith("Short"«»)) {
    try {
    paramShort = Short.parseShort(paramValue);
    }
    catch (NumberFormatException e) {
    if (!commandLine) {
    JOptionPane.showMessageDialog
    (jframe,
    "Invalid Input ("+
    paramValue+"«») "+e,
    "Invalid Short Value",
    JOptionPane.ERROR_MESSAGE );
    }
    continue;
    }
    parameters.put(paramName,new Short(paramShort));
    }
    if (paramClassName.endsWith("Long"«»)) {
    try {
    paramLong = Long.parseLong(paramValue);
    }
    catch (NumberFormatException e) {
    if (!commandLine) {
    JOptionPane.showMessageDialog
    (jframe,
    "Invalid Input ("+
    paramValue+"«») "+e,
    "Invalid Long Value",
    JOptionPane.ERROR_MESSAGE );
    }
    continue;
    }
    parameters.put(paramName,new Long(paramLong));
    }
    if (paramClassName.endsWith("Float"«»)) {
    try {
    paramFloat = Float.parseFloat(paramValue);
    }
    catch (NumberFormatException e) {
    if (!commandLine) {
    JOptionPane.showMessageDialog
    (jframe,
    "Invalid Input ("+
    paramValue+"«») "+e,
    "Invalid Float Value",
    JOptionPane.ERROR_MESSAGE );
    }
    continue;
    }
    parameters.put(paramName,new Float(paramFloat));
    }
    if (paramClassName.endsWith("Double"«»)) {
    try {
    paramDouble = Double.parseDouble(paramValue);
    }
    catch (NumberFormatException e) {
    if (!commandLine){
    JOptionPane.showMessageDialog
    (jframe,
    "Invalid Input ("+
    paramValue+"«») "+e,
    "Invalid Double Value",
    JOptionPane.ERROR_MESSAGE );
    }
    continue;
    }
    parameters.put(paramName,new Double(paramDouble));
    }
    if (paramClassName.endsWith("Byte"«»)) {
    try {
    paramByte = Byte.parseByte(paramValue);
    }
    catch (NumberFormatException e) {
    if (!commandLine){
    JOptionPane.showMessageDialog
    (jframe,
    "Invalid Input ("+
    paramValue+"«») "+e,
    "Invalid Byte Value",
    JOptionPane.ERROR_MESSAGE );
    }
    continue;
    }
    parameters.put(paramName,new Byte(paramByte));
    }
    if (paramClassName.endsWith("Date"«»)) {
    try {
    paramDate = (java.util.Date)dateFormat.parse(paramValue);
    }
    catch (ParseException e) {
    if (!commandLine){
    JOptionPane.showMessageDialog
    (jframe,
    "Invalid Input ("+
    paramValue+"«»)n "+
    "Please Use Format (dd/mm/yy[yy])n"+e,
    "Invalid Date Value",
    JOptionPane.ERROR_MESSAGE );
    }
    continue;
    }
    parameters.put(paramName,paramDate);
    }
    if (paramClassName.endsWith("String"«»)) {
    parameters.put(paramName,paramValue);
    }
    if (paramClassName.endsWith("Text"«»)) {
    parameters.put(paramName,paramValue);
    }
    break;
    }
    }
    }

    // Set up the SQL connection via our old database open class (hope this
    // was left in a working state!)
    openDatabase = new OpenDatabase("","","",""«»);

    // Fill the report.....
    try {
    outputReport = JasperFillManager.fillReport(reportPath,
    parameters,
    openDatabase.connection);
    }
    catch (JRException e) {
    System.err.println("JReportRunner: Cannot Fill Report ("+
    reportPath+"«») "+e);
    }

    if (runMode.equalsIgnoreCase("V"«») || runMode.equalsIgnoreCase("B"«»)){
    // Now preview the report using the printmanager class....
    try {
    JasperViewer.viewReport(outputReport);
    }
    // Did not compile, because viewReport does not throw this: catch (JRException e) {
    catch (Exception e) {
    System.err.println("JReportRunner: Cannot View Report ("+
    reportPath+"«») "+e);
    }
    }

    // Finally DO something - we have the file format, so case the format
    // and call the respective processor......
    if (runMode.equalsIgnoreCase("F"«») || runMode.equalsIgnoreCase("B"«»)){
    try {
    if (outputFormat.equalsIgnoreCase("pdf"«»)) {
    JasperExportManager.exportReportToPdfFile(outputReport,outputFileName);
    }
    else if (outputFormat.equalsIgnoreCase("html"«»)) {
    JasperExportManager.exportReportToHtmlFile(outputReport,outputFileName);
    }
    else if (outputFormat.equalsIgnoreCase("xml"«»)) {
    JasperExportManager.exportReportToXmlFile(outputReport,outputFileName,1==1);
    }
    else {
    System.err.println("Invalid File Format: ("+outputFormat+"«»)"«»);
    }
    }
    catch (JRException e) {
    System.err.println("JReportRunner: Cannot Create Export ("+
    outputFileName+"«») Type ("+outputFormat+"«») "+e);
    }
    }
    }
    }

     

    However I get the error

     

    JReportRunner: Cannot Compile Report (C:DatajrunnerTest.jrxml) net.sf.

    jasperreports.engine.JRException: Error compiling report java source files : C:

    DatajrunnerUnnamed_1189149333642_675773.java

    Exception in thread "main" java.lang.NullPointerException

    at JReportRunner.main(JReportRunner.java:127)

     

    When Running the command line

     

    "java -classpath C:DataiReportsiReport-1.3.1libcommons-beanutils-1.7.jar;C:

    DataiReportsiReport-1.3.1libcommons-collections-2.1.jar;C:DataiReportsiR

    eport-1.3.1libcommons-digester-1.7.jar;C:DataiReportsiReport-1.3.1libcomm

    ons-logging-1.0.2.jar;C:DataiReportsiReport-1.3.1libjasperreports-1.3.1.jar

    ;C:datajrunner JReportRunner F C:DatajrunnerTest.jasper c:anoutfile

    .pdf -Ddbase.driversun.odbc.JdbcOdbcDrive -Ddbase.urlBBR -Ddbase.user

     

    I've little knowlage of java and would appriciate any pointers you can give.

     

    Many thanks in advance

  13. Hi

     

    Attached files as requested.

     

    many thanks [file name=GraphProblem.jrxml size=5322]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/GraphProblem.jrxml%5B/file] size=335]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/snap.jpg

×
×
  • Create New...