Results 1 to 6 of 6
  1. #1
    Join Date
    May 2004
    Posts
    5

    Unanswered: Parameter problem with JBuilder bundled Crystal Reports

    After alot of trouble I was able to configure a JNDI connection for a 4.1 tomcat server launched from theJBuilder IDE (Informix was a big problem).
    However, I am now having a problem passing parameters. Whenever I try to run code without parameters supplied the viewer prompts for the parameter but ignores it/self resets. If I pass parameters and disable parameter prompting I get the following error message:

    com.crystaldecisions.report.web.viewer.CrystalRepo rtViewer
    Some parameters are missing values

    The report works normally using Crystal Reports 9 and I have verified that my JNDI connection to the informix database works from within the JBuilder Enterprise X IDE.

    Here is my source code:

    <%@ page import="com.crystaldecisions.report.web.viewer.*,
    com.crystaldecisions.sdk.occa.report.data.*"
    %>
    <%@ page
    import="com.crystaldecisions.reports.reportenginei nterface.JPEReportSourceFactory,
    com.crystaldecisions.sdk.occa.report.reportsource. IReportSourceFactory2,
    com.crystaldecisions.sdk.occa.report.reportsource. IReportSource"
    %>

    <%
    String report;

    report = "/reports/test4.rpt";

    IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
    IReportSource reportSource = (IReportSource)
    rptSrcFactory.createReportSource(report, request.getLocale());


    //*try to set a parameter source
    Fields fields = new Fields();
    ParameterField pfield1 = new ParameterField();

    Values vals1 = new Values();

    ParameterFieldDiscreteValue pfieldDV1 = new ParameterFieldDiscreteValue();

    pfield1.setName("Type");
    pfieldDV1.setValue("RPTCOMM");
    pfieldDV1.setDescription("RPTCOMM type of report");

    vals1.add(pfieldDV1);

    pfield1.setCurrentValues(vals1);
    fields.add(pfield1);

    CrystalReportViewer viewer = new CrystalReportViewer();
    viewer.setReportSource(reportSource);

    viewer.setParameterFields(fields);
    viewer.setEnableParameterPrompt(false);

    viewer.refresh();

    viewer.processHttpRequest(request, response,getServletConfig().getServletContext(), out);

    viewer.dispose();
    %>

  2. #2
    Join Date
    Jun 2004
    Posts
    1

    Just Wondering

    I have the same problem. Mine works great when the parameters are prompted for but not when set programmatically . Did you end up resolving this?

  3. #3
    Join Date
    Mar 2004
    Posts
    2

    about the jndi connection

    hi, can you tell me how to configure the JNDI connection for a 4.1 tomcat server launched from theJBuilder IDE? I also use informix.

  4. #4
    Join Date
    Jun 2004
    Posts
    5

    solution:

    add this line:

    pfield1.setReportName("");

    bay...

  5. #5
    Join Date
    May 2004
    Posts
    5
    Quote Originally Posted by stephie_huang
    hi, can you tell me how to configure the JNDI connection for a 4.1 tomcat server launched from theJBuilder IDE? I also use informix.
    Hi, I used the following plugin: http://opentools.mot.net.tw/TomcatTools/index.htm

    I also had to get a new dbcp driver because Informix didn't interact well with the one I had.

  6. #6
    Join Date
    Nov 2004
    Posts
    3

    Unhappy I need help whit my Report in JBuilder!!!!

    Hi!!! first I have to say that my english isn't good, and I hope that you understand what I say, I'm a pruvian, and I'm doing a web aplication using CrystalReport 10 for JBuilderX... and I have problems when I passing parameters from JSP to CrystalReport..., the code thata I'm using is:

    <%@page import="com.crystaldecisions.reports.reportenginei nterface.JPEReportSourceFactory"%>
    <%@page import="com.crystaldecisions.sdk.occa.report.repor tsource.IReportSourceFactory2"%>
    <%@page import="com.crystaldecisions.sdk.occa.report.repor tsource.IReportSource"%>
    <%@page import="com.crystaldecisions.report.web.viewer.Cry stalReportViewer"%>
    <%@page import="com.crystaldecisions.sdk.occa.report.data. *"%>

    <%
    try
    {
    String reportLocation;
    reportLocation = "/WEB-INF/ReportJDBC.rpt";
    IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
    Object reportSource = (IReportSource)rptSrcFactory.createReportSource(re portLocation, request.getLocale());

    // Store report object in a session for enhanced performance.
    session.setAttribute("reportSource", reportSource);

    // Create a collection that will hold all parameters that are passed.
    Fields campos = new Fields();

    // Create a parameter object for a single parameter.
    ParameterField param1 = new ParameterField();
    param1.setReportName("ReportJDBC.rpt");
    param1.setName("@numSUBCENTROCOSTO_ID");

    // Create a Values collection that can hold multiple values for a single parameter.
    Values valor1 = new Values();

    // Create a single value and add it to the values collection.
    ParameterFieldDiscreteValue paramDV1 = new ParameterFieldDiscreteValue();
    Integer SUBCENTRO_ID = new Integer("4");
    paramDV1.setValue(SUBCENTRO_ID);
    paramDV1.setDescription("");
    valor1.add(paramDV1);

    // Set the current values for the parameter.
    param1.setCurrentValues(valor1);

    // Add the parameter to the parameter collection.
    campos.add(param1);



    // Instantiate the viewer.
    CrystalReportViewer viewer;
    viewer = new CrystalReportViewer();

    viewer.setOwnPage(false);
    viewer.setOwnForm(true);

    // Set the viewer's report source.
    viewer.setReportSource(session.getAttribute("repor tSource"));

    // Pass the parameter collection to the viewer.
    viewer.setParameterFields(campos);

    // Disable parameter prompting.
    viewer.setEnableParameterPrompt(true);

    viewer.setHasRefreshButton(true);

    // Set the viewer's remaining attributes.
    viewer.refresh();

    // Display the viewer.

    viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
    //response.sendRedirect("MostrarReport.jsp");
    viewer.dispose();

    }

    catch(Exception e)
    {
    // Output an error message
    out.println("The following error has been caught: " + e.getMessage());
    }

    %>


    The web Page load the parameters, but no display the report... I don't know what to do...
    Can you help me????? please!!!!!
    my e-mail is yapepi@hotmail.com
    I would appreciated your help!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •