Page 1 of 1

Custom names in the dictionary

Posted: Fri Jan 04, 2008 7:19 am
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.

Custom names in the dictionary

Posted: Fri Jan 04, 2008 8:23 am
by Brendan
You can use the Alias property for the columns in the Datasource.

Custom names in the dictionary

Posted: Fri Jan 04, 2008 8:52 am
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();
}


Custom names in the dictionary

Posted: Fri Jan 04, 2008 9:07 am
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.

Custom names in the dictionary

Posted: Mon Jan 07, 2008 2:27 am
by dj_uvdata
Thank you for the help now I get a complete list of "My Custom alias"

Custom names in the dictionary

Posted: Mon Jan 07, 2008 2:35 am
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.