Page 1 of 1

How to use Table/ Column Display Name in DataSource tree

Posted: Fri Oct 27, 2006 5:56 pm
by ngaheer
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

Posted: Sat Oct 28, 2006 6:21 am
by Vital
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:

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";
}
If you need show only alias without name you can use static properties in StiOptions:

Code: Select all

StiOptions.Dictionary.ShowOnlyAliasForComponents
StiOptions.Dictionary.ShowOnlyAliasForVariable
StiOptions.Dictionary.ShowOnlyAliasForDataSource
StiOptions.Dictionary.ShowOnlyAliasForDataColumn
StiOptions.Dictionary.ShowOnlyAliasForDataRelation
Thank you.