default parameter is each available parameter seperated

2 posts, 0 answers
  1. PaTTa
    PaTTa avatar
    1 posts
    Member since:
    Dec 2018

    Posted 05 Dec 2018 Link to this post

    Hello,

    we are using Telerik Report Designer v 10.1.16.615 and we created a report where Avaliable Parameters (P1) are  from SQL Querry where is the input another Parameter (P2). But what we need is to generate this report for each of this Avaliable values Separately as Default.
    So I choose the P1 to not be a Multiple-valued (so for every Parameter its generated separately) but now we need to use EACH of the avaliable parameter to be Default so the Report will generate One report for Each of the avaliable value.

    I tried to use fuction =AllValues  but this function could not be called. Is there any other option so be able to do this ?
    Thanks

  2. Todor
    Admin
    Todor avatar
    289 posts

    Posted 10 Dec 2018 Link to this post

    Hello PaTTa,

    On a single run (from the designer, or in a report viewer) the report will be generated once, according to the current values of the report parameters. If you set a report parameter to be Multivalue, it will still have one value - an array of the selected single values.

    If you would like to render the same report for all possible values of a report parameter, you may iterate through the values (i.e. foreach over all possible report parameter values) and render the report inside the loop with the current parameter value. You may use the ReportsProcessor :

    UriReportSource uriReportSource = new UriReportSource();
    uriReportSource.Uri = @"..\..\Reports\Report1.trdp";
     
    IEnumerable<string> reportParameterAvailableValues = new List<string>() { "1", "2", "3", "4", "5" };
     
    Hashtable deviceInfo = new Hashtable();
     
    ReportProcessor processor = new ReportProcessor();
    foreach (string reportParameter in reportParameterAvailableValues)
    {
        uriReportSource.Parameters.Clear();
        uriReportSource.Parameters.Add("Parameter1", reportParameter);
        RenderingResult result = processor.RenderReport("PDF", uriReportSource, deviceInfo);
     
        string fileName = result.DocumentName + "_" + reportParameter + "." + result.Extension;
     
        using (FileStream fs = new FileStream(fileName, FileMode.Create))
        {
            fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
        }
    }

    Regards,
    Todor
    Progress Telerik
    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