Dynamic creation of report vs data source
Posted: Fri Mar 28, 2008 6:06 am
Hi,
I'm just a begginer in using stimul soft (my company bought it now), but I need to work with it to create custom report and dynamic reports.
What do I need: I need to create on-fly dynamic report class that I will show in StiReport preview control. It will show
simple types of charts (bars, clustered columns and pies) and data band which will represent DataSet table data.
Now I've created my class inhereted from StiReport class and I've created (dynamically) charts and table (depending on user data set entered).
But the problem I have is this: when I register RegData my DataSet to report and choose for chart : argument column to be column of a table and value column to be aslo column from a table, and when I do Render() on my custom report class I get "Specific cast invalid" exception which I guess means this:
Report can't convert my DataSet.Table columns to StiDataTableSource. Now I've tried to do something like this
But after compile/render of report I get "Invalid token ';' in class, struct, or interface member declaration" in some temporary file used by sti report library....
Please where am I getting this wrong? Is there some method to convert DataTable (.net) to StiDataTableSource. Or I have to create my own properties in my custom StiDataTableSource which will use something like:
So, in short, I need to conect .NET DataTable object to sti report dynamically and create Charts / Table from it (also dynamically).
In addition I've looked where the problem is with invalid casting (with Reflector) it seems to be in RenderChart method, but the method is huge, so I really don't know what could be the problem..
Please advise,
Thank you very much in advance!
Igor
I'm just a begginer in using stimul soft (my company bought it now), but I need to work with it to create custom report and dynamic reports.
What do I need: I need to create on-fly dynamic report class that I will show in StiReport preview control. It will show
simple types of charts (bars, clustered columns and pies) and data band which will represent DataSet table data.
Now I've created my class inhereted from StiReport class and I've created (dynamically) charts and table (depending on user data set entered).
But the problem I have is this: when I register RegData my DataSet to report and choose for chart : argument column to be column of a table and value column to be aslo column from a table, and when I do Render() on my custom report class I get "Specific cast invalid" exception which I guess means this:
Report can't convert my DataSet.Table columns to StiDataTableSource. Now I've tried to do something like this
Code: Select all
DataTable sourceTable = reportDataSource.Tables[0];
StiDataTableSource destinationTable = stiReportDataSource;
foreach (DataColumn column in sourceTable.Columns)
{
StiDataColumn stiColumn = new StiDataColumn(column.ColumnName, column.ColumnName, column.ColumnName, column.DataType);
destinationTable.Columns.Add(stiColumn);
}
this.DataSources.Add(stiReportDataSource);
Please where am I getting this wrong? Is there some method to convert DataTable (.net) to StiDataTableSource. Or I have to create my own properties in my custom StiDataTableSource which will use something like:
Code: Select all
((string)(StiReport.ChangeType(this["Name"], typeof(string), true)));
In addition I've looked where the problem is with invalid casting (with Reflector) it seems to be in RenderChart method, but the method is huge, so I really don't know what could be the problem..
Please advise,
Thank you very much in advance!
Igor