SubReport - CSV File

4 posts, 0 answers
  1. Brian
    Brian avatar
    33 posts
    Member since:
    Mar 2016

    Posted 22 Feb 2017 Link to this post

    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

  2. Katia
    Admin
    Katia avatar
    693 posts

    Posted 23 Feb 2017 Link to this post

    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 (stackoverflow).

    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
  3. Brian
    Brian avatar
    33 posts
    Member since:
    Mar 2016

    Posted 28 Feb 2017 in reply to Katia Link to this post

    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.

  4. Katia
    Admin
    Katia avatar
    693 posts

    Posted 01 Mar 2017 Link to this post

    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
Back to Top