Custom names in the dictionary

Stimulsoft Reports.NET discussion
Post Reply
dj_uvdata
Posts: 17
Joined: Fri Jan 04, 2008 6:36 am
Location: denmark

Custom names in the dictionary

Post by dj_uvdata »

Hi

I use a List as data source to teh report. The directory's visible datasource is a view of the properties of the objects in the list. I would like to be able to rename the visible names for the user.

Does anyone know how to do this?

Thank you.
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Custom names in the dictionary

Post by Brendan »

You can use the Alias property for the columns in the Datasource.
dj_uvdata
Posts: 17
Joined: Fri Jan 04, 2008 6:36 am
Location: denmark

Custom names in the dictionary

Post by dj_uvdata »

i do the following but nothing changes.

Do I need to refresh the data or somthing?

public string FixAlias()
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < Dictionary.DataSources.Count; i++)
{
for (int j = 0; j < Dictionary.DataSources.Columns.Count; j++)
{
Dictionary.DataSources.Columns[j].Alias = "hurra";
sb.AppendLine(Dictionary.DataSources.Columns[j].Alias);
}
}

return sb.ToString();
}

Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Custom names in the dictionary

Post by Brendan »

After you register your Datasource, try calling Synchronize on the Dictionary of the report:

Code: Select all

StiReport report = new StiReport();
report.RegData(myTableData);
report.Dictionary.Synchronize();

foreach(Stimulsoft.Report.Dictionary.StiDataSource dSource in report.DataSources)
{
	foreach(Stimulsoft.Report.Dictionary.StiDataColumn col in dSource.Columns)
	{
		col.Alias = "My Custom Alias";
	}
}

report.Design();

You can also Set Aliases through the Report Designer by Right clicking the Column in the Datasource tree and choosing Properies.
The Alias names will be saved with your report.
dj_uvdata
Posts: 17
Joined: Fri Jan 04, 2008 6:36 am
Location: denmark

Custom names in the dictionary

Post by dj_uvdata »

Thank you for the help now I get a complete list of "My Custom alias"
dj_uvdata
Posts: 17
Joined: Fri Jan 04, 2008 6:36 am
Location: denmark

Custom names in the dictionary

Post by dj_uvdata »

I found that myself:

Code: Select all

            StiOptions.Dictionary.ShowOnlyAliasForData = true;
            StiOptions.Dictionary.ShowOnlyAliasForDatabase= true;
            StiOptions.Dictionary.ShowOnlyAliasForDataColumn= true;
            StiOptions.Dictionary.ShowOnlyAliasForDataRelation= true;
            StiOptions.Dictionary.ShowOnlyAliasForDataSource = true;
            StiOptions.Dictionary.ShowOnlyAliasForVariable= true;

Thank you for the help.
Post Reply