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

Filtering report using a parameter not working at runtime

1 Answer 182 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Larry
Top achievements
Rank 1
Larry asked on 26 Oct 2019, 06:20 PM

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);

 

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 30 Oct 2019, 02:29 PM

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
Tags
General Discussions
Asked by
Larry
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or