Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Crystal Reports Dynamic Changing of Data Source

Good day Sirs:

this is my first post here, should i violate any rules, please accept my humblest apologies.

I would like to ask your help regarding my problem. Im using Eclipse Europa and Crystal Reports XI. What I would like to do is to dynamically change the DataSource of my Crystal Report. I believe I have done that with the following codes:

Tables tables = rptClientDoc.getDatabaseController().getDatabase().getTables();

for (int i = 0; i < tables.size(); i) {

ITable origTable = tables.getTable(i);

ITable newTable =(ITable)((IClone) origTable).clone(true);

+newTable.setName(DB_SCHEMA + newTable.getName());+

newTable.setAlias(newTable.getAlias());

origTable.setQualifiedName(newTable.getName());

IConnectionInfo connectionInfo = newTable.getConnectionInfo();

PropertyBag propertyBag = new PropertyBag();

propertyBag.put("Trusted_Connection", "false");

propertyBag.put("Server Name", SERVER_NAME);

propertyBag.put("Connection String", CONNECTION_STRING);

propertyBag.put("Database Name", DB_NAME);

propertyBag.put("Server Type", "JDBC (JNDI)");

propertyBag.put("URI", URI);

propertyBag.put("Use JDBC", "true");

propertyBag.put("Database DLL", DB_DLL);

connectionInfo.setAttributes(propertyBag);

rptClientDoc.getDataDefController().getDataDefinition().getParameterFields();

connectionInfo.setUserName(USER_NAME);

connectionInfo.setPassword(USER_PWD);

connectionInfo.setKind(ConnectionInfoKind.SQL);

newTable.setConnectionInfo(connectionInfo);

rptClientDoc.getDatabaseController().setTableLocation(origTable,newTable);

}

But I recieve this Error Message: JRCAgent1 detected an exception: No results were returned by the query.

It seems that my Parameters are not seen by the query, having this code:

ParameterFieldController paramFieldController = rptClientDoc.getDataDefController().getParameterFieldController();

Fields params = rptClientDoc.getDataDefController().getDataDefinition().getParameterFields();

for (int j = 0; j < params.size(); j++) {

IParameterField parameterField = (IParameterField) params.getField(j);

}

Your help will be a great lift to my dipping morale...

Thank you very much and I hope to hear from anybody soon...

Edited by: grayscale on Sep 28, 2009 8:34 AM

replied

Hmmm, in that case use the following sample:

[http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/40c2b287-3f11-2c10-d8af-9be95b69fe82]

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question