Preview Template at Web Designer

Posted by: sonnguyentruong87 on 11 March 2020, 7:02 am EST

    • Post Options:
    • Link

    Posted 11 March 2020, 7:02 am EST

    I have some existing report templates which dataset objects is populated using code c#

    report.Document.LocateDataSource += new LocateDataSourceEventHandler(Report_OnLocateDataSource);
    

    Can I preview those template in the Web designer ? . If I can then How should I implement ? .

  • Posted 12 March 2020, 4:48 am EST

    Hello,

    You can preview the same by tweaking some code in the reporting service as follow:

    
    
                app.UseReporting(config => {
                    config.UseFileStore(ResourcesRootDirectory); //Return the dataTable
                    config.LocateDataSource = args =>
                    {
                        if (args.Report.Name == "DataSet.rdlx")
                            return GetTable();
                        else
                            return 0;
                    };
                });
    
    

    Thanks,

    Mohit

  • Posted 12 March 2020, 5:23 am EST

    Thanks.

  • Posted 12 March 2020, 7:20 am EST

    As I input some parameter values at the right panel of the preview viewer, How can I catch that value inside the handler LocateDataSource ?

    I tried debug and inspected, I found the parameter value didn’t

    exist in args.Report.ReportParameters

  • Posted 12 March 2020, 7:37 am EST

    Hello,

    Could you please try after adding the same parameter in the datasets. You need to map the report parameter with the query parameters of the dataset. After that you can access the parameter in the LocateDataSource by following way:

    args.Parameters[0]
    

    Thanks,

    Mohit

  • Posted 12 March 2020, 8:14 am EST

    Hi Mohit,

    as per 2 things:

    • Adding the same parameter in the datasets,
    • Mapping the report parameter with the query parameters of the dataset.

      How exact should I implement those ?

      If there’s any related instruction document resource for dev, please give me the URL .

    Thank you.

  • Posted 12 March 2020, 8:10 pm EST

    Hi Mohit,

    I think I found how to make it. Thank you again.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels