Parameter Passing to Subreport Database Command in CR2008 using java

Hi
In subreport i have  a query which accept parameter from the parameter list and works fine in crystal report designer but using java when i am trying to pass the parameter form it gives me error ERROR java.lang.nullpointer Exception. Below is the code attached to send parameter to subreport.
oReportClientDocument = new ReportClientDocument ();
            oReportClientDocument.open ( strRepPath, 0 );
            reportSource = oReportClientDocument.getReportSource ();
            oCrystalReportViewer = new CrystalReportViewer ();
            oCrystalReportViewer.setOwnPage ( true );
            oCrystalReportViewer.setOwnForm ( true );
            oCrystalReportViewer.setDisplayGroupTree ( false );
            oCrystalReportViewer.setDisplayToolbar ( true );
            oCrystalReportViewer.setPrintMode ( CrPrintMode.PDF );
          if ( fields != null )
                oFields = new Fields ();
                if ( !fields.isEmpty () )
                    o = null;
                    i = null;
                    o = new Object ();
                    i = fields.keySet ().iterator ();
                    while ( i.hasNext () )
                        o = i.next ();
                         setParamaterFields ( oFields, o.toString (), fields.get ( o ) );
                oCrystalReportViewer.setParameterFields ( oFields );

Hi David,
I guess you already have the parameters in the Main report.
Create a formula called Start_Date:
Min({?Date_Parameter})
Create another formula called End_date:
Max({?Date_Parameter})
Next, insert the sub-report with Order details table as the datasource.
Then, right-click the subreport and select Change Subreport Links > Move the Start_date formula and End_date to the 'Fields to link to' area and make sure you uncheck the option 'Select data in subreport based on field' for both of them.
Then, you also wish to link Salesman_Id, so move this field to the 'Fields to link to' area and from the drop-down for 'Select data in subreport based on field' select the Salesman_ID from the sub-report.
Now, right-click the sub-report and select Edit subreport. The design page of the Subreport opens up. Go to Report > Record Selection formula and it should show {?pmSalesman_ID} = . Edit the selection formula to include the start and end date like this:
*{?Pm-Salesman_ID} = and (ORDER_DATE >= {?Pm-@Start_date} or ORDER_DATE <= {?Pm-@End_date})*
Let me know how this goes!
-Abhilash

Similar Messages

  • Update database logon in reports using java

    Please review the code below and let me know where did I go wrong! I am able to login to CMS and able to retrieve the list of reports. Now, I am trying to update the database credentials for a single report using java (My requirement is to update all 200 reports though!).
    This is the 100th time I go this error message: Failed to open the connection.report.lib.ReportSDKServerException: Failed to open the connection.
    I also wrote a sample java program which tries to connect to the sql server database with same login credentials - this works perfectly fine. But, if I use the same connection url, driver name and login credentials, this report fails to update for whatever reason. Please help me ASAP..Thanks!
    import com.crystaldecisions.sdk.exception.*;
    import com.crystaldecisions.sdk.framework.*;
    import com.crystaldecisions.sdk.occa.infostore.*;
    import com.crystaldecisions.sdk.occa.managedreports.*;
    import com.crystaldecisions.sdk.occa.report.application.*;
    import com.crystaldecisions.sdk.occa.report.data.*;
    import com.crystaldecisions.sdk.occa.report.lib.*;
    import java.util.Iterator;
    class ChangeDataSource {
        public static void main(String args[]){
             String cms = "134.X.X.X:6400";
             String username = "Administrator";
             String password = "";
             String auth = "secEnterprise";
             IEnterpriseSession enterpriseSession = null;
             ISessionMgr sessionMgr = null;//CrystalEnterprise.getSessionMgr();   
             Exception failure = null;
             boolean loggedIn = true;
             ReportClientDocument clientDoc = null;
             if (enterpriseSession == null)
              try
                  sessionMgr = CrystalEnterprise.getSessionMgr();
                  enterpriseSession = sessionMgr.logon(username, password, cms, auth);
                  System.out.println("\nLOGIN SUCCESSFUL\n");
              catch (Exception error)
                  loggedIn = false;
                  failure = error;
              if (!loggedIn)
                   System.out.println("\nLOGIN FAILED\n");
              else
                  // Query for the sample report from the Enterprise CMS.
                  try {
                        IInfoStore iStore = (IInfoStore) enterpriseSession.getService("InfoStore");
                        IInfoObjects infoObjects = iStore.query("Select SI_ID From CI_INFOOBJECTS Where SI_INSTANCE=0 AND SI_PARENT_FOLDER=771");
                        System.out.println("\ninfoObjects size = "+infoObjects.getResultSize());
                        IReportAppFactory reportAppFactory = (IReportAppFactory)enterpriseSession.getService("RASReportFactory");
                        IInfoObject infoObject = (IInfoObject)infoObjects.get(0);      
                        clientDoc = new ReportClientDocument();
                        clientDoc = reportAppFactory.openDocument(infoObject,0, java.util.Locale.US);
                        System.out.println("Report "+ infoObject.getTitle() +" Opened");     
                        switch_tables(clientDoc.getDatabaseController());
                   }catch(ReportSDKException re){                    
                        re.printStackTrace();
                   }catch(SDKException re){
                        re.printStackTrace();
         private static void switch_tables(DatabaseController databaseController) throws ReportSDKException {
              //Declare the new connection properties that report's datasource will be switched to.
              //NOTE: These are specific to using JDBC against a particular MS SQL Server database.  Be sure to use the
              //DisplayConnectionInfo sample to determine what your own connection properties need to be set to.
              final String TABLE_NAME_QUALIFIER = "dbname.dbo.";
              final String DATABASE_NAME = "dbname";
              final String DBUSERNAME = "userid";
              final String DBPASSWORD = "pword";
              final String SERVERNAME = "134.X.X.X";
              final String CONNECTION_URL = "jdbc:sqlserver://134.X.X.X:1433;DatabaseName=dbname";
              final String DATABASE_CLASS_NAME = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
              final String DATABASE_DLL = "crdb_jdbc.dll";
              //Obtain collection of tables from this database controller.
              Tables tables = databaseController.getDatabase().getTables();
              System.out.println("\nTables size = "+tables.size());
              //Set the datasource for all main report tables.
              for (int i = 0; i < tables.size(); i++) {
                   //ITable currTable = tables.getTable(i);     
                   ITable table = tables.getTable(i);
                   //Keep existing name and alias.
                   table.setName(table.getName());
                   table.setAlias(table.getAlias());
                   //System.out.println("Table Name = "+table.getName()+" Alias "+table.getAlias());
                   //Change properties that are different from the original datasource.
                   table.setQualifiedName(TABLE_NAME_QUALIFIER + table.getName());
                   System.out.println(table.getQualifiedName());
                   //Change connection information properties.
                   IConnectionInfo connectionInfo = null;
                   try{
                        connectionInfo = table.getConnectionInfo();
                        //System.out.println("conn info: "+connectionInfo);
                   }catch(Exception re) {
                        re.printStackTrace();
                   //Set new table connection property attributes.
                   PropertyBag propertyBag = new PropertyBag();
                   //Overwrite any existing properties with updated values.
                   propertyBag.put("Trusted_Connection", "false");
                   propertyBag.put("Connection URL", CONNECTION_URL);
                   propertyBag.put("Database Class Name", DATABASE_CLASS_NAME);
                   propertyBag.put("Server", SERVERNAME);
                   //propertyBag.put("Database Name", DATABASE_NAME);
                   propertyBag.put("Server Type", "JDBC (JNDI)");
                   //propertyBag.put("URI", null);
                   propertyBag.put("Use JDBC", "true");
                   propertyBag.put("Database DLL", DATABASE_DLL);
                   connectionInfo.setAttributes(propertyBag);
                   System.out.println("\n Properties SET\n");
                   //Set database username and password.
                   //NOTE: Even if these the username and password properties don't change when switching databases, the
                   //database password is *not* saved in the report and must be set at runtime if the database is secured. 
                   connectionInfo.setUserName(DBUSERNAME);
                   connectionInfo.setPassword(DBPASSWORD);
                   connectionInfo.setKind(ConnectionInfoKind.SQL);
                   table.setConnectionInfo(connectionInfo);
                   //Update old table in the report with the new table.
                   try {
                        databaseController.setTableLocation(table, tables.getTable(i));               
                        }catch(ReportSDKException re) {
                        re.printStackTrace();
                   System.out.println("\n All tables updated\n");

    I have exactly same error. I can confirm that CRJavaHelper.changeDataSourceReportClientDocument clientDoc,
                    String reportName, String tableName,
                    String username, String password, String connectionURL,
                    String driverName,String jndiName)
    has very slow performance.
    Obviously the line:
                        clientDoc.getDatabaseController().setTableLocation(origTable, newTable);
    works very slow. I also have JDBC defined in report and also stored procedure, that returns recordset (cursor) in 0.48 sec.
    I am using CR Reports Server XI R2 and custom JAVA client program that renders report to pdf.
    Lines from java program:
    rpt = new ReportClientDocument();
    String report = "C:
    temp
    CrystalReport1.rpt";
    rpt.open(report, com.crystaldecisions.sdk.occa.report.application.OpenReportOptions._openAsReadOnly);
    CRJavaHelper.changeDataSource(rpt, "The specified item was not found.", "", "jdbc:oracle:thin:@oratest:1521:oratest","oracle.jdbc.driver.OracleDriver", "");
    CRJavaHelper.addDiscreteParameterValue(rpt, "", "P_INET_ID", id);
    rpt.refreshReportDocument();
    PDFExportFormatOptions pdfOptions = new PDFExportFormatOptions();
    ExportOptions exportOptions = new ExportOptions();
    exportOptions.setExportFormatType(ReportExportFormat.PDF);
    exportOptions.setFormatOptions(pdfOptions);
    InputStream is = rpt.getPrintOutputController().export(exportOptions);

  • Call Unix Command From Reports Using Java

    Hi,
    Could somebody please show me a sample coding to call Unix command from 10g report using java?
    In metalink doc id 361857.1 does not show much.
    Thanks,
    neemin

    Hi,
    I have a problem with synchronization of the java commands.
    In the Before Parammeter Form trigger, I have:
    function BeforePForm return boolean is
    rt ORA_JAVA.JOBJECT;
    proc ORA_JAVA.JOBJECT;
    v_txt varchar2(32000);
    i integer := 0;
    v_cd_modulo int;
    v_arqlog text_io.file_type;
    cursor c_evento is
    select codigo,
    nome
    from
    (select e.cd_evento || e.cd_edicao codigo
    ,nm_evento nome
    from grh_ev_evento e
    where e.CD_GRUPO in (select cd_grupo
    from grh_ev_adm
    where cd_usuario = (select cd_usuario
    from usuario
    where login_usuario = :AUTHID)))
    order by substr(nome, 11);
    begin
    -- Create the context for logged user
    if instr(upper(nvl(:AUTHID,'RWCLIENT')),'RWCLIENT') > 0 then
    :AUTHID := :SSO_USUARIO;
    end if ;
    TCEENV.SET_TCEENV(:AUTHID);
    if PK_SCA.SCA_GET_USER_RIGHTS(:sca_module_name, :AUTHID) IS NULL then
    srw.message(100, 'Access denided!');
    return (FALSE);
    end if;
    -- Create file in Report Server (UNIX)
    v_txt := '<BR>' || htf.formSelectOpen('P_EV_EDICAO', 'Evento: ');
    :p_file := '/u03/SCAWEB/repout/' || :sca_module_name || '_' ||
    pk_sca.sca_encrypt(:AUTHID || to_char(systimestamp, 'ss.ff'));
    v_arqlog := text_io.fopen (:p_file, 'A');
    text_io.put_line (v_arqlog, v_txt);
    for reg in c_evento loop
    i := i + 1;
    if i = 1 then
    v_txt := '<OPTION SELECTED VALUE="' || reg.codigo || '">' || reg.nome;
    else
    v_txt := '<OPTION VALUE="' || reg.codigo || '">' || reg.nome;
    end if;
    text_io.put_line (v_arqlog, v_txt);
    end loop;
    v_txt := '</SELECT></CENTER></form></BODY> </HTML>';
    text_io.put_line (v_arqlog, v_txt);
    text_io.fclose (v_arqlog);
    SRW.SET_AFTER_FORM_HTML(SRW.FILE_ESCAPE, :p_file);
    rt := RUNTIME.GetRuntime();
    proc := RUNTIME.exec(rt,'rm ' || :p_file);
    return (TRUE);
    end;
    The problem is that there isn't a "synchronize" command, and the
    RUNTIME.exec(rt,'rm ' || :p_file) don't works (it does nothing) because
    the SRW.SET_AFTER_FORM_HTML has a large delay and the following
    command is ignored.
    How can I solve it?
    thanks,
    lmprestes

  • How to write from database to XML file using JAVA and back..

    Hi....
    I am strugling for a code to write from database to xml output instead of what i have written in flat file....could anyone please help me out...to do this and again read the same back to the database using java...

    Hi,
    In java world, there is a tutorial on what you are looking for :
    http://www.javaworld.com/javaworld/jw-01-2000/jw-01-dbxml_p.html
    It uses SAX/DOM parsers to translate XML data into the appropriate fields of the database and visa-versa.
    Hope it helps.

  • How parameter passed to subreport

    Hi all,
    I define some parameters in main report and matching parameters in subreport, and pass the value from main to sub to control some sections in sub. I can get the supposed result in some subreports, but all. I am just wondering it is right to pass value between main and subreport using parameters.
    Thank you very much!
    Clara

    Hi Clara,
    It is perfectly acceptable to pass values between a main report and a subreport using parameters.  Just make sure that you are linking the main report parameters to the correct subreport parameters or you may find some strange results.

  • How to pass Key Event from command prompt to the java application

    If iam running a application that displays JFrame when i pressed CTR+C at the command prompt i.e console window please let me know how can it be passed to the JFrame ie application window

    I doubt that you can pass Ctrl+C to the application since the application is terminated by this key combination.
    You would try adding a WindowListener or may use a shutdown hook to capture the termination of the JVM.

  • SOURCING10: Passing parameters to a Query Based webservice using JAVA

    Hi Experts,
    I have been working on consuming a Query based webservice published in Souricng10 in a simple JAVA class. The query has a filter parameter which is not mandatory. I am able to consume the webservice using the GET method and display the content of the webservice. But when i try to POST a value to the filter parameter of the query i am getting the following error:
    java.io.IOException : Server returned HTTP response code: 415 for URL: http://sapcild9.web.bc:55000/sourcing/ngservices/rest/query/Z_TEST_WS_QUERY/execute/
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    Following is the code which i have used:
       URL url = new URL("http://sapcild9.web.bc:55000/sourcing/ngservices/rest/query/Z_TEST_WS_QUERY/execute/");
       HttpURLConnection connection = (HttpURLConnection)url.openConnection();
       connection.setRequestProperty("Authorization", "Basic " + authStringEnc);
       connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
       connection.setRequestProperty("Content-Length", "" +Integer.toString(urlParameters.getBytes().length));
       connection.setRequestProperty("Content-Language", "en-US");
       connection.setUseCaches (false);
       connection.setDoInput(true);
       connection.setDoOutput(true);
       connection.setAllowUserInteraction(true);
       connection.setInstanceFollowRedirects(false);
       connection.setRequestMethod("POST");
       connection.connect();
       //Send request
       OutputStream out = connection.getOutputStream();
       OutputStreamWriter wr= new OutputStreamWriter(out, "UTF-8");
       wr.write("EXTERNAL_ID");
       wr.write("=");
       wr.write(URLEncoder.encode("temp","UTF-8"));
       wr.close();
       out.close();
       is = connection.getInputStream();
       isr =new InputStreamReader(is);
       BufferedReader bufferReader = new BufferedReader(isr);
       String str; StringBuffer stringBuffer = new StringBuffer();
       while ((str = bufferReader.readLine()) != null) {
       stringBuffer.append(str);
       stringBuffer.append("\n");
       System.out.println(stringBuffer.toString());
       connection.disconnect();
       is.close();
    Please Advise how to proceed on this isssue?
    Thanks in advance.
    Srikanth Emani

    Hi Gael,
    your URL is made up of :
    [ProcedureName]?[parameter1]=[value1]&[parameter2]=[value2]
    creating URLs like this can have problems especially with spaces and punctuation.
    the answer is a FORM
    the following will create a hidden form :
    FORM ACTION="[ProcedureName]" METHOD="POST" name="F1"
    INPUT type="HIDDEN" name="[parameter1]" value="[value1]"
    INPUT type="HIDDEN" name="[parameter2]" value="[value2]"
    /FORM
    you can set the values in the form using:
    document.F1.[parameter1].value="abc123%%&&$$!";
    document.F1.submit();
    will submit the form and the PL/SQL procedure should receive the text as it was contained in the form.
    the only characters that can now cause problems are :
    " as it delimits the field.
    ' as it may cause problems in PL/SQL.
    \ as it is a special character.
    Regards Michael

  • How do i import my local csv files into HANA database as temporary tables  using java program?

    I want to import my local csv file into database for further apply Join with other tables programmatic in JAVA

    Hi Vivek,
    Please go through the following blogs and video to resolve your issue.
    Loading large CSV files to SAP HANA
    HANA Academy - Importing Data using CTL Method - YouTube
    Hope it helps.
    Regards
    Kumar

  • How to implement linux's "more" command's function use java?

    In linux, we can type as following:
    more [filename]
    we can view the file's content ,page up, page down etc.
    can java implement such more command's function?

    the j2se libraries don't have an abstraction for getting information like this - so java is effectively unaware of a console
    there is an enhancement request for this - i've not heard any mention of this getting into Tiger (??)
    http://developer.java.sun.com/developer/bugParade/bugs/4050435.html
    when i had a go at this
    http://forum.java.sun.com/thread.jsp?forum=31&thread=408133
    and kind of relevent
    http://forum.java.sun.com/thread.jsp?forum=54&thread=445190
    asjf

  • Passing database command parameter to sub-report

    I'm trying to pass a runtime parameter from a main report to a database command parameter in a sub-report, and having some trouble.
    My main report has parameter fields (Vendor, Manufacturer, etc) that the user selects at runtime - the result set includes Item Code - that part is working fine.  Where I'm having trouble is with linking to the sub-report.  My sub-report has a stored command that takes a parameter (ItemCode) and counts the number of times it's shown up on an invoice.  When I created the command, it asked for a value for the parameter, and won't accept a blank entry.  Now, whenever I try to run the main report, it asks for the ItemCode parameter for the sub-report - which kind of defeats the purpose.  I've tried linking from ?Pm-OITM.ItemCode in the main report, but the Subreport Links window doesn't show the Command parameter to link to.
    How do I take a field from the main report and pass it to a sub-report to be used as a parameter in a stored database command? 
    I'm running CR 2008, and SAP B1 2007 PL 42 on MS SQL 2005, and I'm still pretty new at CR, so details help.
    Thanks.

    Go to change subreport links and add Item Code from main report and then you can see the sureport stored procedure parameter in the Subreport parameters list, select the parameter and do not select any field from subreport.
    You will be able to see the stored procedure parameter in the list only when the Item Code and the parameter are of same data type.
    Regards,
    Raghavendra

  • Weblogic 6.1 SP2 hangs up at database command, PATCH needed!

    Hello,
    I use weblogic 6.1 SP2 on Windows and Solaris
    DB-Driver: Oracle Thin Driver for Oracle 9i
    Database OP System: Win2000
    My application runs fine. After some time (about 15.000 db operations)
    at load tests, the weblogic 6.1 server hangs up without an error message
    in the logs at a any desired database command.
    I use the database pool from weblogic.
    The database operations are made with the TX-Datasource.
    The main database operation is a call of an oracle stored
    procedure.
    I suppose, that the weblogic hangs up in a synchronized
    block of the pool, but the crash could also have an other reason.
    After the crash, the whole instance is dead and must be restarted.
    I can reconstruct the crash on windows and solaris.
    I always thought, weblogic is reliably?
    Is there any patch to fix this problem?
    I am very thankful for every help to fix this problem.
    Thank you in advance
    Markus

    Hi,
    here is the source code of the the stateless session bean (S1), which
    calles the oracle stored procedure.The commit or rollback is done in
    the main interface (stateless session bean with user managed
    transactions).
    java.sql.CallableStatement stmt=null;
    java.sql.Connection conn = null;
    try {
    javax.sql.DataSource ds =
    at.one.bmw.system.SystemConfig.getDataSource();
    conn=ds.getConnection();
    stmt=conn.prepareCall("{call routeChargingRecord(?,?,?,?,?,
    int i=1;
    stmt.setString(i++,seq_number);
    stmt.setInt(i++,custTypeID.intValue());
    stmt.setString(i++,msisdn.toString());
    stmt.setLong(i++,billing_serviceID.longValue());
    stmt.setLong(i++,serviceGroupID.longValue());
    stmt.setString(i++,transactionID);
    stmt.setInt(i++,typeID.intValue());
    stmt.setInt(i++,applicationID.intValue());
    stmt.setString(i++,gateway_number);
    stmt.setString(i++,smsc_serviceID);
    stmt.setString(i++,smsc_tarifID);
    stmt.setString(i++,desc);
    stmt.setString(i++,beneficiaries);
    stmt.setString(i++,attr0);
    stmt.setString(i++,attr1);
    stmt.setString(i++,attr2);
    stmt.setString(i++,attr3);
    stmt.setString(i++,deliveryNotes);
    int xx=stmt.executeUpdate();
    try { stmt.close();  } catch (Exception en) {}
    try { conn.close();  } catch (Exception eb) {}
    conn=null; stmt=null;
    } // end try
    catch (Exception e) {
    this.sessionContext.setRollbackOnly();
    try { stmt.close();  } catch (Exception en) {}
    try { conn.close();  } catch (Exception eb) {}
    throw new EJBAppException(msg+"\n"+e.getMessage());
    } // end catch
    Thank you for your help.
    "Sree Bodapati" <[email protected]> wrote in message news:<[email protected]>...
    Hi Markus,
    Can you please post the test code that can demonstrate the hang here.
    sree
    "Markus Häusler" <[email protected]> wrote in message
    news:[email protected]...
    Hello,
    I use weblogic 6.1 SP2 on Windows and Solaris
    DB-Driver: Oracle Thin Driver for Oracle 9i
    Database OP System: Win2000
    My application runs fine. After some time (about 15.000 db operations)
    at load tests, the weblogic 6.1 server hangs up without an error message
    in the logs at a any desired database command.
    I use the database pool from weblogic.
    The database operations are made with the TX-Datasource.
    The main database operation is a call of an oracle stored
    procedure.
    I suppose, that the weblogic hangs up in a synchronized
    block of the pool, but the crash could also have an other reason.
    After the crash, the whole instance is dead and must be restarted.
    I can reconstruct the crash on windows and solaris.
    I always thought, weblogic is reliably?
    Is there any patch to fix this problem?
    I am very thankful for every help to fix this problem.
    Thank you in advance
    Markus

  • JRC bug: apostrophe in string parameter passed to Crystal Report with Command datasource to SQL Server

    Post Author: nl11087
    CA Forum: JAVA
    A single quote/apostrophe in string parameter passed to a Crystal Report with Command datasource connecting to a SQL Server database, using sqljdbc driver does not escape the special character correctly. When doing a preview in the Crystal Reports IDE it allows you to escape the input parameter as expected and work correctly, but through the JRC component it fails. For string parameters without special sql server characters I experience no problems at all. When replacing the Command with a direct table there is also no problem.
    Reproduction:
    1. create a database db1, create a table table1 with a String type column col1.
    2. Create new report Report1.rpt, create a connection to above, Add Command using 'SELECT col1, col2, col3 FROM table1 WHERE col1 = '{?Par1}' . Add a parameter field Par1 : String
    3. In your java stand alone application using JRC add the parameter Par1 with a value "Jon Doe's Value" containing a single apostrophe. Export to PDF. (I also tried MSWord and this failed too, similar behavior). Additionally, in another test try to replaceAll("'","''") to escape it, preventing the code to break, but now it does not retrieve the expected row anymore and you end up with an empty report.
    Exception StackTrace:
    com.crystaldecisions.reports.exportinterface.exceptions.ExportException: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
    Caused by: com.crystaldecisions.reports.formatter.formatter.c: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.l.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.a(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    ... 17 more
    Caused by: com.crystaldecisions.reports.dataengine.be: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.nr(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bn(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bp(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.s.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.aa(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    ... 23 more
    Caused by: com.crystaldecisions.reports.reportdefinition.datainterface.n: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.reportdefinition.datainterface.p.a(Unknown Source)
    ... 35 more
    Caused by: com.crystaldecisions.reports.queryengine.driverImpl.m: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.queryengine.driverImpl.o.eC(Unknown Source)
    at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.ea(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.h(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.dV(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ax.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cy(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cz(Unknown Source)
    at com.crystaldecisions.reports.queryengine.b1.bc(Unknown Source)
    ... 36 more
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 's'.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StatementExecutionRequest.executeStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(Unknown Source)
    ... 48 more
    - JRCAgent3 detected an exception: An error occured while exporting the report
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)

    Post Author: nl11087
    CA Forum: JAVA
    A single quote/apostrophe in string parameter passed to a Crystal Report with Command datasource connecting to a SQL Server database, using sqljdbc driver does not escape the special character correctly. When doing a preview in the Crystal Reports IDE it allows you to escape the input parameter as expected and work correctly, but through the JRC component it fails. For string parameters without special sql server characters I experience no problems at all. When replacing the Command with a direct table there is also no problem.
    Reproduction:
    1. create a database db1, create a table table1 with a String type column col1.
    2. Create new report Report1.rpt, create a connection to above, Add Command using 'SELECT col1, col2, col3 FROM table1 WHERE col1 = '{?Par1}' . Add a parameter field Par1 : String
    3. In your java stand alone application using JRC add the parameter Par1 with a value "Jon Doe's Value" containing a single apostrophe. Export to PDF. (I also tried MSWord and this failed too, similar behavior). Additionally, in another test try to replaceAll("'","''") to escape it, preventing the code to break, but now it does not retrieve the expected row anymore and you end up with an empty report.
    Exception StackTrace:
    com.crystaldecisions.reports.exportinterface.exceptions.ExportException: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
    Caused by: com.crystaldecisions.reports.formatter.formatter.c: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.l.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.a(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    ... 17 more
    Caused by: com.crystaldecisions.reports.dataengine.be: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.nr(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bn(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bp(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.s.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.aa(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    ... 23 more
    Caused by: com.crystaldecisions.reports.reportdefinition.datainterface.n: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.reportdefinition.datainterface.p.a(Unknown Source)
    ... 35 more
    Caused by: com.crystaldecisions.reports.queryengine.driverImpl.m: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.queryengine.driverImpl.o.eC(Unknown Source)
    at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.ea(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.h(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.dV(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ax.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cy(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cz(Unknown Source)
    at com.crystaldecisions.reports.queryengine.b1.bc(Unknown Source)
    ... 36 more
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 's'.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StatementExecutionRequest.executeStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(Unknown Source)
    ... 48 more
    - JRCAgent3 detected an exception: An error occured while exporting the report
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)

  • Using a date filed as a parameter in a subreport Command.

    Post Author: JSC
    CA Forum: General
    I understand how create a date field in the master report. 
    I undertand how to define that field as a "subreport link"  (said subreport has command as it's only "table") 
    I understand how to "add" a parameter to the parameter list of the subreport command.
    I do not understand how to specify that the "sub report link" field is to be read into the command as a parameter.
    Two Date fields in master report:  DateBegin and DateEnd
    Subrpt command need to select information based on the range between DateBegin and DateEnd.
    What is the procedure?  CR11 help is "no help", unless I am simply asking the wrong question.
    JSC

    As per your suggestion my sql query is
    SELECT : p_organization_id,:p_from_date,:p_to_date,tab.* from (&x_sql) tab
    My initial value for the lexical parameter is
    SELECT 'a' F1, 'b' F2, 1 F3, 'r1' reason1,  'r2' reason2 FROM DUAL
    F1,F2,F3 for the three fixed columns and r1,r2 for the dynamic columns.
    I got the output after running the report:-
    <?xml version="1.0" encoding="UTF-8" ?>
    - <!--
    Generated by Oracle Reports version 10.1.2.3.0
    --> 
    - <INHOUSE_REJ> 
    - <LIST_G_P_ORGANIZATION_ID1> 
    - <G_P_ORGANIZATION_ID1> 
    <P_ORGANIZATION_ID1>88</P_ORGANIZATION_ID1>  
    <P_FROM_DATE1>01-JAN-15</P_FROM_DATE1>  
    <P_TO_DATE1>13-FEB-15</P_TO_DATE1>  
    <F1>a</F1>  
    <F2>b</F2>  
    <F3>1</F3>  
    <REASON1>r1</REASON1>  
    <REASON2>r2</REASON2>  
    </G_P_ORGANIZATION_ID1>
    </LIST_G_P_ORGANIZATION_ID1>
    </INHOUSE_REJ>
    I  I need the output:-
    - <INHOUSE_REJ>
    - <LIST_G_P_ORGANIZATION_ID1> 
    - <G_P_ORGANIZATION_ID1> 
    <P_ORGANIZATION_ID1>88</P_ORGANIZATION_ID1>  
    <P_FROM_DATE1>01-JAN-15</P_FROM_DATE1>  
    <P_TO_DATE1>13-FEB-15</P_TO_DATE1>  
    <PART_NAME>PEGEOUT  1.8 CYLINDER HEAD CASTING H29</PART_NAME>  
    <OK_QTY>12420</OK_QTY>  
    <CASTING_DAMAGE>10</CASTING_DAMAGE>  
    </G_P_ORGANIZATION_ID1>
    </LIST_G_P_ORGANIZATION_ID1>
    </INHOUSE_REJ>

  • Passing range-value into a parameter of a subreport

    Hello all
    I've a problem with passing a formula into a parameter of the subreport.
    I'm using a SAP BW query with a data range parameter. So I have to provide a range value first for executing this query.
    I'd like to execute the query with a data range between the last two weeks. For this purpose if created a formula with following code:
    [dateadd('d',-14,currentdate),currentdate]
    This means, the result is an array. And exactly this is the problem. Because Crystal Reports doesn't support an array as a result of a formula.
    Is there an other possibility for passing the array/data range to the parameter in the subreport?
    I'm using Crystal Reports for enterprise (v.14.0.2).
    Kind regards,
    Greg

    Thanks, kglad. I was wondering about that. I thought that
    putting a variable data type of :Number would have made it a
    number, but I never got an error in the debugger so I thought it
    was ok. I traced the data type and figured out it was actually a
    string and changed the line like follows which turned the string to
    an integer and made it work:
    var image01ClosedPosition:Number =
    parseInt(RootNode1.attributes.imageChangeX);

  • Parameter passing from master to subreport

    Is it possible to pass a multi-value parameter from a master report to one or more subreports? If so, how?
    Thanks for any help.
    Wayne E. Pfeffer

    Yes you can do this. I suggest the following: In your subreport make the report parameter a multi-value parameter. Test the subreport stand alone and make sure it works. Then drop the subreport into your main report, and map the subreport parameters to the main report parameters.
    Scenario 1 (multi value parameter pass through):
    The Main report has report parameter A which is a multi value parameter. You want to pass it to SubReport1 which has a report parameter B which is also defined as multi value parameter. In this case the mapping is just a simple parameter expression: =Parameters!A.Value
    The subreport RDL element would look like this:
              <Subreport Name="SubReport1">
                <Parameters>
                  <Parameter Name="B">
                    <Value>=Parameters!A.Value</Value>
                  </Parameter>
                </Parameters>
              </Subreport>  
    Scenario 2:
    The Main report has no report parameters. You have a SubReport1 with a report parameter B defined as multi value parameter. You want to pass e.g. three selected values "A", "B", "C" as parameter values to the subreport. You need to create a multidimensional object array on-the-fly, e.g. with the Split function, e.g.: =Split("A,B,C", ",")
    RDL example:
              <Subreport Name="SubReport1">
                <Parameters>
                  <Parameter Name="B">
                    <Value>=Split("A,B,C", ",")</Value>
                  </Parameter>
                </Parameters>
              </Subreport>
    Scenario 3:
    The Main report has a multi-value parameter A. You want to pass only the first selected value from the main report's parameter to the subreport and the subreport's report parameter B is a single-value parameter. You can do this by using e.g. =Parameters!A.Value(0)
    RDL example:
              <Subreport Name="SubReport1">
                <Parameters>
                  <Parameter Name="B">
                    <Value>=Parameters!A.Value(0)</Value>
                  </Parameter>
                </Parameters>
              </Subreport>
    -- Robert

Maybe you are looking for

  • Apple mobile device failed to start in Windows 7

    I'm receiving an error messgae upon iTunes install "Apple mobile device service failed".  I'm using Windows 7.  I uninstalled iTunes & when I tried to reinstall I conintued to get the same message.  I even restored my PC back to Jan-21 and tried to r

  • Upgrade to Acrobat 9

    I am running Windows XP and have purchased CS5 which includes Acrobat 9.  I have installed all of CS5 but before I can install Acrobat 9 I need to remove Acrobat 8.1.5 (which was installed within CS3). No matter what I do, I have been unable to remov

  • PDF viewer for Firefox?

    Does anyone know how to view pdf files from the firefox browser? I downloaded the pdf viewer and it works with safari, but I usually use firefox..... Thanks

  • Trouble connecting shuffle to my infiniti g37.

    i just bought a new shuffle and tried to connect it to the usb port on my infiniti G and the screen just says check device. any ideas?

  • Class to Class Allocation Table

    Hi, I've assigned a class to another class to create a hierarchical structure. Which table can I find this allocations? For example, both classes B and C are assigned to class A creating a hierarchy. But in which table this assignment is stored? Plea