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

How to use external types in a report?

3 Answers 102 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tiago
Top achievements
Rank 1
Tiago asked on 27 Sep 2013, 12:28 PM
Hi,

I have a few reports that require me to call my own assemblies to format some data. For example, I have an extension Method that translates an enumeration to some resource string:

   = MyClass.GetEnumResource(Fields.ItemStatus)

Aditionally, I also need to make comparisons with my own types for formatting purposes. Something like:

 = IIF(Fields.OrderStatus = MyEnumeration.Refused, " n/a", Fields.OrderPrice)

Problem is, any reference to an external assembly or type generates the dreaded "The expression contains object 'xxxx' that is not defined in the current context". I've also tried to Assembly.Load("MyAssembly") in the report construtor, but to no avail...

I'm aware that there is a solution for the standalone report designer, which involves configuring it's XML config file, but I'm running my reports with Report processor. Something like this:

MyReport report = new MyReport ();
report.DataSource = myModelData;
 
ReportProcessor reportProcessor = new ReportProcessor();
InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
 
instanceReportSource.ReportDocument = report ;
 
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
 
return result.DocumentBytes;

Is it possible to tell the ReportProcessor where to find my assemblies?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 02 Oct 2013, 12:11 PM
Hello,

Generally resolving all of the referenced assemblies static methods will have enormous performance impact and the user functions list will be endless. Thus by design we resolve only the report's project static methods/user functions. In order to keep your current project structure our suggestion is to use method wrappers to invoke referenced assemblies static methods.

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

0
David Cowan
Top achievements
Rank 1
answered on 17 Dec 2013, 05:28 PM
Why not allow a mechanism to tell the reporting engine extra assemblies to inspect?
0
Stef
Telerik team
answered on 20 Dec 2013, 06:48 PM
Hi David,

Test to configure the application through which you run the report (design Preview - VS or the Standalone Designer, report viewer - custom application) as described in the Extending Report Designer and the related articles.

I hope this information helps you.

Regards,
Stef
Telerik

New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

Tags
General Discussions
Asked by
Tiago
Top achievements
Rank 1
Answers by
Peter
Telerik team
David Cowan
Top achievements
Rank 1
Stef
Telerik team
Share this question
or