title: Run a Crystal Report using SQL command table providing where condition values from Java
body: <p>I could run the report/ export the report in pdf format from crystal reports Java project  from eclipse.  this report gets data from  SQL command table.</p>
  
  <p>I need help in running the report template giving "where condition " parameters used in the SQL command table .</p>
  
  <p>Below is my code but not sure why the report that gets created is always with the same default values given in the SQL command. </p>
  
  <pre><code>ReportClientDocument boReportClientDocument = new ReportClientDocument();
  boReportClientDocument.setReportAppServer(com.crystaldecisions.sdk.occa.report.application.  ReportClientDocument.inprocConnectionString);
  
      boReportClientDocument.open("Cintron1.rpt", 0);
  DatabaseController databaseController =   boReportClientDocument.getDatabaseController();
      com.crystaldecisions.sdk.occa.report.data.Tables tables = databaseController.getDatabase().getTables();
  
        //Set the datasource for all main report tables.
        for (int i = 0; i &lt; tables.size(); i++)
        {
  
         com.crystaldecisions.sdk.occa.report.data.ITable table =  (com.crystaldecisions.sdk.occa.report.data.ITable) tables.getTable(i);
         if( table instanceof    com.crystaldecisions.sdk.occa.report.data.CommandTable){
  
         IProcedure command = (IProcedure)table;
         String commandtxt = command.toString();
         ParameterField commandParam = (ParameterField) command.getParameters().get(0);
             commandParam.getDescription();
             Values       values1=       commandParam.getCurrentValues();
             IValue val = values1.get(0);
  
              System.out.println("param field: "+commandParam.getDescription() +"value: "+val.computeText());
              Values values = new Values();
              ParameterFieldDiscreteValue pfdv = new ParameterFieldDiscreteValue();
              pfdv.setValue("6453");
              values.add(pfdv);
              commandParam.setCurrentValues(values);
              values1= commandParam.getCurrentValues();
              val = values1.get(0);
              System.out.println("param field after change: "+commandParam.getDescription() +"value: "+val.computeText());
       IConnectionInfo connectionInfo =   table.getConnectionInfo();
       connectionInfo.getAttributes();
  
         }
        }
  
  
  boReportClientDocument.checkDatabaseAndUpdate();
      boolean isUpdated = boReportClientDocument.getIsModified();
  boReportClientDocument.close();
  
      PrintOutputController printOutputController =
      boReportClientDocument.getPrintOutputController();
      ByteArrayInputStream byteIS = (ByteArrayInputStream)   printOutputController.export(ReportExportFormat.PDF);
  
          OutputStream out = new FileOutputStream("C:\\test123.pdf");
  
          // Transfer bytes from in to out
          byte[] buf = new byte[1024];
          int len;
          while ((len = byteIS.read(buf)) &gt; 0) {
              out.write(buf, 0, len);
          }
          byteIS.close();
          out.close();
  
          }
  </code></pre>