on 09-29-2008 7:22 AM
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
Simply changing the property won't work. RAS uses a Model-View-Controller architecture. You'll need to use the Controller to modify any aspect of the report.
I suggest you have a look at the links below. Make sure you are making a copy of your current table using the Clone method then use the Modify method to apply the changes to your report.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.