Print Page | Close Window

c# csv datasource -dynamic fielname

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22071
Printed Date: 04 May 2024 at 5:35am


Topic: c# csv datasource -dynamic fielname
Posted By: WiglWagl
Subject: c# csv datasource -dynamic fielname
Date Posted: 25 Aug 2016 at 11:34pm
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



Replies:
Posted By: kevlray
Date Posted: 26 Aug 2016 at 5:07am
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.


Posted By: hilfy
Date Posted: 26 Aug 2016 at 5:46am
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

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: WiglWagl
Date Posted: 29 Aug 2016 at 1:26am
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



Print Page | Close Window