This is a migrated thread and some comments may be shown as answers.

SubReport - CSV File

3 Answers 132 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 22 Feb 2017, 03:22 PM

Morning.

I am wondering if this is possible using the standalone designer.

I have a report already built that I need to insert a subreport into. However, the sub report needs to use a CSV file as its datasource (main report is using SQL Native). The path to this CSV is stored as a STRING in my main report query. So the MainReport has a SQL statement similar to:

Select Field1, Field2, ....'Path to CSV File' as dsCSV  From SomeTable

I know need to tell the subreport that the field dsCSV is the path to the file it should use.

Any ideas as to if this is possible (good program so I assume everything is possible) and how it would be done (looking for an example).

Note that I only have the standalone designer.

Thanks,

Brian

3 Answers, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 23 Feb 2017, 03:28 PM
Hello Brian,

First, thank you for your feedback!

To achieve this scenario the Designer needs to be extended with a user function. This user function can take a string with CSV file path as a parameter, read the CSV data from this file and convert it to a DataTable.
Sample approaches for converting CSV data to a DataTable are provided in this thread ().

After that, the user function can be used to set sub report's data source. This can be achieved by adding a binding for the DataSource property to sub report's Bindings collection:
PropertyPath: DataSource
Expression: = Telerik.Reporting.Report.Report1.ConvertCSVToDatatable(Parameters.Parameter1.Value)

At last, on configuring the SubReport item's ReportSource map Parameter1 parameter to the data field containing the path to the CSV file - SubReport (Passing Parameters to a SubReport).

Note, that Designer's configuration needs to be extended so it can recognize the user function - Extending Report Designer.

I hope this helps.


Regards,
Katia
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Brian
Top achievements
Rank 1
answered on 28 Feb 2017, 07:15 PM

Katia,

Not sure if you would have the answer to this. Our application has the Telerik program wrapped in a DLL file. As such, our customer base is not running the standalone exe of the program (not a developer so not sure how they do this...other then they work).

How would I extend the function when I don't have the exe at run time but just a dll.

0
Katia
Telerik team
answered on 01 Mar 2017, 01:45 PM
Hi Brian,

If the end user uses one of the Report Viewers to view report then user functions can be added to the application itself (as a separate project for example).
After that, you can invoke a user function from loaded assembly in the report's item expression as following:
= MyUserFunctions.ResolveUrl("~/Images/Logo.jpg")

More detailed information can be found in User Functions help article. The application configuration file will still needs to be extended - Extending Expressions.


Regards,
Katia
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Report Designer (standalone)
Asked by
Brian
Top achievements
Rank 1
Answers by
Katia
Telerik team
Brian
Top achievements
Rank 1
Share this question
or