# Reports

This document describes the overall design of the reporting mechanism of modernized applications.

This document assumes knowledge of modernized application concepts such as `DataManagerControl`(*TODO ADD LINK TO DATAMANAGER DOC*). Also basic knowledge of concepts from the original platform is required.

## Overview of report processing in the original platform <a href="#overview-of-report-processing-in-the-original-platform" id="overview-of-report-processing-in-the-original-platform"></a>

In *PowerBuilder* reports are *DataWindows* that are created for printing. Some kinds of DataWindows are usually used as reports (for example: Label, Composite) . However all other kinds of *DataWindows* (ex. *FreeForm*) could also be used as reports. The rendering process is performed **in-process** by the runtime environment..

In the modernized application the *DataWindows* are converted to *DataManagers* (TODO LINK TO DATAMANAGER DOC). *DataManager* classes are converted to C# , For example a simple *DataManager* looks like this:

```
[Mobilize.WebMap.Common.Attributes.Observable]
public partial class d_my_report
   : Mobilize.Web.DataManager, Mobilize.Web.IDataManager
{

   [Mobilize.WebMap.Common.Attributes.Intercepted]
   public Mobilize.Web.DmText name_t { get; set; }

   [Mobilize.WebMap.Common.Attributes.Intercepted]
   public Mobilize.Web.DmColumn _name { get; set; }

   ...

   public d_my_report()
   : base()
   {
      ...
      this.PrintSpecification.PrinterName = "";
      this.PrintSpecification.DocumentName = "";
      this.PrintSpecification.Orientation = Mobilize.Web.CaseExtensions.String("0");
      this.PrintSpecification.Margin.Left = 110;
      this.PrintSpecification.Margin.Right = 110;
      this.PrintSpecification.Margin.Top = 96;
      this.PrintSpecification.Margin.Bottom = 96;
      this.PrintSpecification.Paper.Source = 0;
      this.PrintSpecification.Paper.Size = 0;
      ...
      this.name_t = new Mobilize.Web.DmText();
      this.name_t.Band = Mobilize.Web.CaseExtensions.String("detail");
      this.name_t.Alignment = 1;
      this.name_t.Text = "Name:";
      this.name_t.Border = 0;
      this.name_t.Color = "33554432";
      this.name_t.X = 37;
      this.name_t.Y = 4;
      this.name_t.Height = 64;
      this.name_t.Width = 174;
      this.name_t.Name = Mobilize.Web.CaseExtensions.String("name_t");
      this.name_t.Visible = true;
      this.name_t.Font.FontFace = "Tahoma";
      this.name_t.Font.Height = -10;
      ...
      this.name_t.Background.Color = "536870912";
      this._name = new Mobilize.Web.DmColumn();
      this._name.Band = Mobilize.Web.CaseExtensions.String("detail");
...
      }
}
```

DataManager instances are converted *at runtime* to the format used for rendering the report. The following sections describe the process of converting these objects to a PDF representation of the report.

## Rendering in the target platform <a href="#rendering-in-the-target-platform" id="rendering-in-the-target-platform"></a>

A modernized application uses *Microsoft SQL Server Reporting Services* (henceforth referred as SRSS) reporting technology. This solution offers a lot of services for creating and interacting with reports. More information about this solution see MSDN [What is SQL Server Reporting Services (SSRS)?](https://docs.microsoft.com/en-us/sql/reporting-services/create-deploy-and-manage-mobile-and-paginated-reports?view=sql-server-ver15) .

The main way to use SRSS is to use a set server side web services. These services are used to render and store reports (more information see MSDN [Report Server Web Service Methods](https://docs.microsoft.com/en-us/sql/reporting-services/report-server-web-service/methods/report-server-web-service-methods?view=sql-server-ver15) ). Modernized applications *do not use* these webservices and do not require using the SRSS server side process. Instead of this, modernized applications use the *ReportViewer* ASP.NET control to convert a report definition and data to a PDF document . This ReportViewer control is provided by Microsoft [WebForms ReportViewer Control](https://docs.microsoft.com/en-us/sql/reporting-services/application-integration/using-the-webforms-reportviewer-control?view=sql-server-ver15) .

Microsoft reporting services solution uses the *Report Definition Language* (henceforth referred as RDL) for defining reports. This language is specified here: [Report Definition Language (SSRS)](https://docs.microsoft.com/en-us/sql/reporting-services/reports/report-definition-language-ssrs?view=sql-server-ver15) .

### ReportWatcher service <a href="#reportwatcher-service" id="reportwatcher-service"></a>

Modernized applications target the **.NET Core** development and execution environment. This environment provides flexibility and performance features such as cross platform execution, flexible deployment, modern development tools,etc. More information can be found here <https://docs.microsoft.com/en-us/dotnet/core/about> .

Since .NET Core is a new implementation of the .NET environment, there is no binary compatibility with existing .NET assemblies. There are APIs defined in the full .NET Framework that are not compatible with .NET Core. This is true for Microsoft's ReportViewer.As described in the previous section, this is the component used to render report . This component depends on the ASP.NET WebForms infrastructure. Having a *direct* dependency in this control implies that the modernized application cannot take advantage of the .NET Core features. This is the reason of having an external service that take care of rendering the report. This service is called *ReportWatcher*.

The ReportWatcher service is a small webservice dedicated to render reports on modernized applications. It has a dependency on ReportViewer and the full .NET Framework. This service can be hosted on a server different from the one that runs the modernized application. When a report needs to be rendered, the modernized application invokes this web service with everything required to render the report (report definition and data) and returns a PDF .

More information how to configure or use this service is provided in the following sections.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gapvelocity.ai/webmap/powerbuilder-to-.net/reports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
