Share via


Binding to an Unmanaged RAS Server Using ReportClientDocument.Open() Method

Note

This page describes functionality that is not available in Crystal Reports for Visual Studio, but is available in one of the upgraded versions. For more information about Crystal Reports for Visual Studio, see What is Crystal Reports for Visual Studio? For more information about upgraded versions, see Upgrade Options.

Object Model

This report binding scenario uses ReportClientDocument (see Report Binding with ReportClientDocument Object Model (RAS)).

Location of Reports

The report is located in a file directory that the unmanaged RAS server (see Report Application Server (RAS)) has permissions to access.

Description

This report binding scenario accesses the ReportClientDocument object model directly. It passes a file directory path as an object, and the integer 0 (optional parameter in Visual Basic) into the Open() method of ReportClientDocument. For a code sample, see the section below.

Pros

  • Backwards compatibility: viable method for interacting with reports in the ReportClientDocument object model using RAS 9 and up.

  • Optimized performance: significant performance gains, due to superior performance of the report engine in the Report Application Server (RAS). See Comparing Architectures Across Business Objects Reporting Solutions.

  • Ease of portability: maintains all original code that interacted with reports with the ReportDocument object model, while still providing full access to the underlying ReportClientDocument object model through the ReportDocument.ReportClientDocument property.

    Note

    The ReportClientDocument object model allows you to programmatically create, modify, and save changes to the report definition file. For further information, see ReportClientDocument Object Model (RAS) in Architecture.

  • Direct coding: allows direct access to the ReportClientDocument object model.

Cons

  • Less performance potential: upgrading to an unmanaged RAS server greatly increases report performance, but not as much as by upgrading to a managed RAS server.

To load a report from the local file directory into a RAS server using the Open method of ReportClientDocument

  • The unmanaged RAS server version 9 or greater is installed and verified to be working.

This procedure works only with a project that has been created from Project Setup. Project Setup contains specific namespace references and code configuration that is required for this procedure, and you will be unable to complete the procedure without that configuration. Therefore, before you begin this procedure, you must first follow the steps in Project Setup.

A RAS server only works with Web projects.

  1. Within the ConfigureCrystalReports() method (that you have created in Project Setup), add a string declaration that contains the path to a local report.
> [!NOTE]
> <P>This path is the default directory to store the RAS reports. The RAS server may reject other report paths with an "Access denied" error.</P>


``` vb
Dim reportPath As String = "C:\Program Files\Crystal Decisions\" _
                    & "Report Application Server 10\Reports\" _
                    & "World Sales Report.rpt"
```

``` csharp
string reportPath = "C:\\Program Files\\Crystal Decisions"
      + "\\Report Application Server 10\\Reports"
      + "\\World Sales Report.rpt";
```
  1. Convert the reportPath string to an Object variable.
> [!NOTE]
> <P>The Open() method of ReportClientDocument requires the string as an object, rather than as a string.</P>


``` vb
Dim reportPathAsObject As Object = CType(reportPath, Object)
```

``` csharp
object reportPathAsObject = (object)reportPath;
```
  1. Declare and instantiate ReportClientDocument.

    Dim myReportClientDocument As ReportClientDocument = New
    ReportClientDocumentClass()
    
    ReportClientDocument reportClientDocument = new
    ReportClientDocumentClass();
    
  2. Pass both the report path (as an object variable), and the Options parameter, as the integer 0 (this is optional in Visual Basic), to the Open method of the ReportClientDocument instance.

> [!NOTE]
> <P>This opens the report from the local file directory and loads it into the unmanaged Report Application Server (RAS).</P>


``` vb
myReportClientDocument.Open(reportPathAsObject, 0)
```

``` csharp
reportClientDocument.Open(ref reportPathAsObject, 0);
```
  1. Bind the ReportClientDocument instance to the CrystalReportViewer control.

    myCrystalReportViewer.ReportSource = myReportClientDocument
    
    crystalReportViewer.ReportSource = reportClientDocument;
    
  2. To view the report, build and run your project.

See Also