Skip to Content

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

.NET: Change Crystal Reports datasource in field explorer via XSD and XML

Hi there,

I am changing the datasource of a report during runtime. Afterwards, I would like to change the texts of the fields appearing in the field explorer.

I tried:

CrystalDecisions.ReportAppServer.DataDefModel.XMLDataSetClass xmlDS =

new CrystalDecisions.ReportAppServer.DataDefModel.XMLDataSetClass();

byte[] xmlContent = reportContent.getXmlContent();

byte[] xsdContent = reportContent.getXsdContent();

CrystalDecisions.ReportAppServer.CommonObjectModel.ByteArray xmlData =

new CrystalDecisions.ReportAppServer.CommonObjectModel.ByteArray();

CrystalDecisions.ReportAppServer.CommonObjectModel.ByteArray xsdData =

new CrystalDecisions.ReportAppServer.CommonObjectModel.ByteArray();

xmlData.ByteArray = xmlContent;

xmlDS.XMLData = xmlData;

xsdData.ByteArray = xsdContent;

xmlDS.XMLSchema = xsdData;

rasDoc.DatabaseController.SetDataSource(xmlDS, "", "");

rasDoc.Database.Tables[0].Description = "POMMES";

for (int i = 0; i < rasDoc.DatabaseController.Database.Tables[0].DataFields.Count; i++)

{

rasDoc.Database.Tables[0].DataFields<i>.Name = "TEST";

MessageBox.Show(rasDoc.Database.Tables[0].DataFields<i>.Name);

rasDoc.Database.Tables[0].DataFields<i>.HeadingText = "HOORAY";

rasDoc.Database.Tables[0].DataFields<i>.Description = "NOPE";

MessageBox.Show(rasDoc.Database.Tables[0].DataFields<i>.Description);

MessageBox.Show(rasDoc.Database.Tables[0].DataFields<i>.HeadingText);

}

When running this, the message boxes include the right strings I set before but when this is done, the filed explorer still shows no changes. What am I doing wrong??

Thanks,

Pascal

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