We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use the code class in WINRT?

The WinRT ReportViewer has some limitations in compiling the VB code functions due to the following reasons:

  1. The reports custom code needs to be compiled against the Microsoft.VisualBasic assemblies and that is not possible in the WinRT platform.
  2. The assemblies can be compiled in the server side by using the Microsoft.VisualBasic assemblies and loading it in the WinRT; but this also has the similar problem in loading assemblies and does not support the WinRT platform.

In order to use the reports Code and to avoid these limitations, the WINRT ReportViewer has an alternative solution for the custom Code function support. To use this option, reports custom codes need to be written and compiled in the application.

Steps to run the RDL/RDLC custom code in the WINRT ReportViewer:

  1. Create a new blank Windows Application.

C:\Users\Anandakumar S\Desktop\CustomCode\sshot-1.png

Figure 1: New Windows Application

  1. Add the necessary assemblies to the application.

Figure 2: Necessary assemblies added

  1. Create the ReportViewer from XAML. The following code sample shows the same.

XAML

 

  1. Load the report stream to the ReportViewer and add the DataSource values as given in the following code.

C#

  1. Add a new class Code.cs to the application and specify the namespace Syncfusion.Reports.Helper (for example, namespace Syncfusion.Reports.Helper).

Note: The namespace of the newly created class must be Syncfusion.Reports.Helper (namespace Syncfusion.Reports.Helper)

  1. Add a new static class with the name of the Code (for example, public static class Code).
  2. Add the methods with the Static type that is used in your report code functions (for example, GetValueStatus).

C#

  1. The executing assembly must be added to the ReportViewer’s Assemblies API in order to process the custom code in the WINRT ReportViewer.

C#

  1. You can pass a dataset field, Sales, to this function in an expression.

=Code.GetValueStatus(Sum(Fields!Sales.Value))

  1. Build and Run the application.

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/137390/CustomCode-1321752292.zip

 

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework: Product Version:
4721 04/30/2015 04/30/2015 WinRT SfReportViewer 4.5.1 12.4.0.24
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon