Filtering report using a parameter not working at runtime

2 posts, 0 answers
  1. Larry
    Larry avatar
    11 posts
    Member since:
    Aug 2012

    Posted 26 Oct Link to this post

    I have an MVC ASP.Net 4.61 application. I have a report defined with a parameter and a filter. When I view the preview in the designer, the default parameter works fine and the report is filtered, but when I run the application and it is using RenderReport it appears that the filter is passing a null value to the query so no data is returned. If I put the parameter in a text box I see the Id. My id's are GUIDs stored in a varchar field. If I take off filtering it shows multiple records properly.

     

    var PDFSource = new TypeReportSource();
     PDFSource.TypeName = typeof(rptEmail).AssemblyQualifiedName;
     PDFSource.Parameters.Add(new Telerik.Reporting.Parameter("Id", id));
     
     var ReportProcessor = new ReportProcessor();
     var result = ReportProcessor.RenderReport("PDF", PDFSource, null);
     string PDFPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data", "Test.pdf");

     

    File.WriteAllBytes(PDFPath, result.DocumentBytes);

     

  2. Todor
    Admin
    Todor avatar
    397 posts

    Posted 30 Oct Link to this post

    Hi Larry,

    From the code snippet, I suspect that the variable 'id' passed as a value for the Report Parameter is 'GUID', which is not a valid Report Parameter value. You may test to pass it as a 'String' instead.

    Please, check also the How to use a Guid as value for report parameter or data source parameter? KB article for a different approach when using GUID values. 

    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