on 01-15-2018 9:13 AM
Hi
we are facing below error when mapping database fields to the Sub report. in main report its working fine. appreciate if any one can advised to resolved the issue.
com.crystaldecisions.sdk.occa.report.lib.ReportSDKParameterFieldException: InternalFormatterException---- Error code:-2147217394 Error code name:missingParameterValueError
Code Sample
package javaapplication1;
import com.crystaldecisions.sdk.occa.report.application.ISubreportClientDocument;
import com.crystaldecisions.sdk.occa.report.application.ParameterFieldController;
import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
import com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.Statement;
import oracle.jdbc.OracleTypes;
public class JavaApplication1 {
public static void main(String[] args) {
try {
String report_name = "D:\\report\\Cash_Statement_n.rpt"; //subreport_1.rpt
String exportFileName = "D:\\report\\Cash_Statement.pdf"; //subreport_1.pdf
ReportClientDocument clientDoc = new ReportClientDocument();
clientDoc.open(report_name, ReportExportFormat._PDF);
OracleConnection o = new OracleConnection();
Connection conn = o.getOraConn();
CallableStatement stmt = conn.prepareCall("{call t05_cash_account_log_pkg.cash_statement(?,?,?,?,?)}");
stmt.registerOutParameter(1, OracleTypes.CURSOR);
stmt.setInt(2, 11460);
stmt.setDate(3, Date.valueOf("2013-03-31"));
stmt.setDate(4, Date.valueOf("2018-01-31"));
stmt.setInt(5, 2);
stmt.executeUpdate();
ResultSet rset;
rset = (ResultSet) stmt.getObject(1);
clientDoc.getDatabaseController().setDataSource(rset);
clientDoc.getDataDefController().getParameterFieldController().setCurrentValue("", "pPeriod", "Welcome to Crystal Reports");
clientDoc.getDataDefController().getParameterFieldController().setCurrentValue("", "pMubasherNo", "Welcome to Crystal Reports");
clientDoc.getDataDefController().getParameterFieldController().setCurrentValue("", "pAddress", "Welcome to Crystal Reports");
clientDoc.getDataDefController().getParameterFieldController().setCurrentValue("", "pDisclaimerEn", "Welcome to Crystal Reports");
clientDoc.getDataDefController().getParameterFieldController().setCurrentValue("", "pCurrency", "Welcome to Crystal Reports");
clientDoc.getDataDefController().getParameterFieldController().setCurrentValue("", "pAccountNo", "Welcome to Crystal Reports");
String subReportQuery = "select t05_id as a from t05_cash_account_log";
Statement statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = statement.executeQuery(subReportQuery);
ISubreportClientDocument subreport = clientDoc.getSubreportController().getSubreport("Subreport");
String subreportTableAlias = subreport.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
subreport.getDatabaseController().setDataSource(rs, subreportTableAlias, subreportTableAlias);
ParameterFieldController paramFieldController = clientDoc.getDataDefController().getParameterFieldController();
paramFieldController.setCurrentValue("Subreport", "pMubasherNo", "Test01");
paramFieldController.setCurrentValue("Subreport", "ptest", "Test02");
ByteArrayInputStream bais = (ByteArrayInputStream) clientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
int size = bais.available();
byte[] barray = new byte[size];
FileOutputStream fos = new FileOutputStream(new File(exportFileName));
ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
int bytes = bais.read(barray, 0, size);
baos.write(barray, 0, bytes);
baos.writeTo(fos);
clientDoc.close();
bais.close();
baos.close();
fos.close();
} catch (Exception ex) {
System.out.println(ex);
}
}
}
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.