KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Use a CSV file as my source dynamically #868

Open Giulia Fois opened this topic on on May 14 - 2 comments

Giulia Fois commented on May 14

Hello, I'm trying to generate a report based on data that are stored in a CSV file. However, each time I generate the report the CSV file varies (I need to create different reports for different clients). Is there a way to pass my .csv filename as a parameter to my report class? I tried using the params array, but I need the parameter to be accessible in the settings() function in order to successfully create my CSVDataSource. Thank you so much.

David Winterburn commented on May 14

Hi Giulia,

Please try this code in the report setup function:

$dsSetting = array(
	'filePath' => $this->params["myCsvFilePath"],
	'fieldSeparator' => ';',
$src = new \koolreport\datasources\CSVDataSource($dsSetting, $this);

Let us know this works for you or not. Thanks!

Giulia Fois commented on May 15

Thank you so much, it worked perfectly!

Give tips to supporter for his good work

If you feel that supporter has done a good work, consider giving him some credit. Any amount put into the tips box below is appreciated. By doing so, you have contribtuted to the existence of KoolReport and the quality of support.

Tips box
help needed