Create Field object in RAS
To add field onto report, create a field object first ..
private Field ConvertFieldStringToFieldClass(string fieldString)
{
// get the period index
char period = '.';
int periodIndex = fieldString.IndexOf(period);
// parse out table and field name
string tableName = fieldString.Substring(1, periodIndex-1);
string fieldName = fieldString.Substring(periodIndex+1, fieldString.Length-(periodIndex+2));
Tables tables = _reportClientDocument.DatabaseController.Database.Tables;
int tableIndex = tables.FindByAlias(tableName);
CrystalDecisions.ReportAppServer.DataDefModel.Table table =
(CrystalDecisions.ReportAppServer.DataDefModel.Table)tables[tableIndex];
Fields fields = table.DataFields;
int fieldIndex = fields.Find(fieldName, CrFieldDisplayNameTypeEnum.crFieldDisplayNameName,
CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleEnglishUS);
Field field = (Field)fields[fieldIndex];
return field;
}
0 Comments:
Post a Comment
<< Home