Skip to Content
0
Former Member
Oct 23, 2009 at 08:17 AM

Create RPT with xml and xsd file

374 Views

Hi,

i tried the following code seen on Ted Ueda's blog

/people/ted.ueda/blog/2009/02/02/crystal-reports-for-eclipse-version-2--programmatically-create-reports-off-of-xml-or-web-services-data-sources

put it in a jsp file

<%@ page import="com.crystaldecisions.sdk.occa.report.application.ReportClientDocument"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.application.ReportSaveAsOptions"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.ConnectionInfo"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.Table"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.lib.PropertyBag"%>

<%
		ReportClientDocument reportClientDocument;
		ConnectionInfo connectionInfo;
		PropertyBag propertyBag;
		
		/*
		 * Connect to the Java Print Engine and create a new document.
		 */		
		reportClientDocument = new ReportClientDocument();
		reportClientDocument.setReportAppServer(ReportClientDocument.inprocConnectionString);
		reportClientDocument.newDocument();
		
		/*
		 * Define connection to the XML and XSD files.
		 */
		propertyBag = new PropertyBag();
		propertyBag.put("Local XML File", "C:\\customer.xml");
		propertyBag.put("Local Schema File", "C:\\customer.xsd");
		propertyBag.put("Convert Multivalue to Table", Boolean.FALSE);
		propertyBag.put("Database DLL", "crdb_xml.dll");

		connectionInfo = new ConnectionInfo();
		connectionInfo.setAttributes(propertyBag);
		
		/*
		 * Specify the dataset in the XML as a Table, and add to the report.
		 */
		
		Table table = new Table();
		table.setConnectionInfo(connectionInfo);
		table.setName("dataroot/Customer_Query");
		table.setAlias("dataroot/Customer_Query");
		
		reportClientDocument.getDatabaseController().addTable(table, null);
		
		/*
		 * Save report to file C:\local_xml.rpt
		 */	
		reportClientDocument.saveAs("local_xml.rpt", "C:\\", ReportSaveAsOptions._overwriteExisting);
		reportClientDocument.close();
%>

and i get a "dblogon" error for this line

reportClientDocument.getDatabaseController().addTable(table, null);

where might i be wrong, Ted?

maybe i didn't put the crdb_xml.dll file in the right place?

Where does it have to be stored?

Edited by: dehian2 on Oct 23, 2009 10:24 AM