Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: c# csv datasource -dynamic fielname Post Reply Post New Topic
Author Message
WiglWagl
Newbie
Newbie


Joined: 23 Aug 2016
Online Status: Offline
Posts: 5
Quote WiglWagl Replybullet Topic: c# csv datasource -dynamic fielname
    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
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet 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.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
WiglWagl
Newbie
Newbie


Joined: 23 Aug 2016
Online Status: Offline
Posts: 5
Quote WiglWagl Replybullet 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
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.