c# csv datasource -dynamic fielname

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hi,

is it possible to create a Crytal Report with a dynamic CSV-Datasoruce?

Example:
I created a simple Report bound to a CSV Datasource named "test.csv".

Now we print out of our software and the proble is, we have to create CSV-Files with different names like "test.47.csv, test.55.csv".

How can i add this files to my report during runtime?

Thanks a lot
Rene
I have a similar issue using a ETL process.  Unfortunately the only solution I could come up with is a batch file that changed the name of the source file to a standard name that I could count on being there.
Not from within Crystal itself. However, if you use the .NET or Java SDK to run the report, you can dynamically set the data source at runtime.

-Dell
Hi,

after many hours of searching, i found the solution!

The main problem ist to bind the DataSet in a correct way to the report.

DataSet myDataSet = new DataSet();
myDataApater.Fill(myDataSet);

foreach(DataTable item in myDataSet.Tables)
{
    var t = myReport.Database.Tables(item.TableName);
    t.SetDataSource(item);
}

Thanks all
Rene