Hi,
I have a need to display the Alias Names/ Display Names of Tables and Fields rather than their db table name and column names in the DataSource tree. I am passing DataSet to the report by calling StiReport.RegData() to pass DataSource to it. Which properties should I set on DataTable and DataColumns so that Report Designer honours them instead of showing native table/ column names.
Thanks in advance.
Narinder.
How to use Table/ Column Display Name in DataSource tree
How to use Table/ Column Display Name in DataSource tree
You can specify alias in DataSet only for DataColumn. Property Caption of DataColumn. Regrettably DataSet, DataTable and DataRelation does
not contain similar property. So you need set alias property directly in StimulReport. You can use following code:
If you need show only alias without name you can use static properties in StiOptions:
Thank you.
not contain similar property. So you need set alias property directly in StimulReport. You can use following code:
Code: Select all
report.RegData(data);
report.Synchronize();//Automatically create datasources
foreach (StiDataSource dataSource in report.Dictionary.DataSources)
{
dataSource.Alias = "123";
foreach (StiDataColumn dataColumn in dataSource.Columns)
{
dataColumn.Alias = "123";
}
}
foreach (StiDataRelation dataRelation in report.Dictionary.DataRelations)
{
dataRelation.Alias = "123";
}
Code: Select all
StiOptions.Dictionary.ShowOnlyAliasForComponents
StiOptions.Dictionary.ShowOnlyAliasForVariable
StiOptions.Dictionary.ShowOnlyAliasForDataSource
StiOptions.Dictionary.ShowOnlyAliasForDataColumn
StiOptions.Dictionary.ShowOnlyAliasForDataRelation