_ReportRenderer2::Init Method [C++]

Use this method to initialize the ReportRenderer object and to render or export a static report synchronously.

Definition

[C++]

HRESULT IreportRenderer2::Init(BSTR*sParamString,
  VARIANT_BOOL*pvResult);

[Visual Basic]

Function Init(sParamString As String) As Boolean

Parameters

  • sParamString[C++]
    [in, out] A pointer to a BSTR used to supply parameters to the ReportRenderer object.
  • sParamString[Visual Basic]
    A String used to supply parameters to the ReportRenderer object.
  • pvResult[C++]
    [out, retval] A pointer to a VARIANT_BOOL used to indicate whether the operation was successful. True (1) indicates success.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] If this method completes successfully, it returns a Boolean that indicates whether the initialization was successful. True (1) indicates success.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

The sParamString parameter consists of a string containing six parameters delineated by the '|' symbol. The string is of the form:

   "ReportStatusID|Data warehouse connection string|
    OLAP connection string|Destination connection string|
    Destination table name|Report execution time"

The possible parameters consist of the following:

  • ReportStatusID - used to identify the report to be displayed or exported. This parameter is stored in the ReportStatus table which is created when a report is run or exported.
  • Data warehouse connection string - where the underlying data is stored. A valid connection string is of the type "Provider=SQLOLEDB;Data Source=Server Name;Initial Catalog=Database Name;Integrated Security='SSPI'".
  • OLAP connection string - where the underlying OLAP data is stored. A valid connection string is of the type "Provider=msolap;DATA SOURCE=Server Name;INITIAL CATALOG=Database Name;". You will use the OLAP connection string only with reports that are based on OLAP.
  • Destination connection string - where the table that will contain the exported report data is located. A valid connection string is of the type "Provider=SQLOLEDB;Data Source=Server Name;Initial Catalog=Database Name; Integrated Security='SSPI'".
  • Destination table name - the table that will contain the exported report data.
  • Report execution time - the time when the report was executed. If not supplied, this defaults to the current time in the format of the client computer.

The actual parameters used depend on the type of report (SQL or MDX) and whether the report is being displayed or exported. The ReportStatusID and the Data warehouse connection string parameters are required in all cases. The remaining parameters are required, as shown in the following table. Parameters not used are left blank.

Action-
Report
Type
Report
StatusID
Data
Warehouse
connection
string
OLAP
connection
string
Destination
connection
string
Destination
table name
Report
execution
time
Display-SQL X X X
Display-MDX X X X X
Export-SQL X X X X
Export-MDX X X X X X

The ReportRenderer object constrains displayed reports with the following limitations:

  • Maximum of 1000 rows.
  • Maximum of 50 columns.
  • Maximum of 5 dimension levels for each row or column dimension.

The number of rows and columns is determined by the report query, report parameters, and report definitions. The number of dimensions is set in the ReportDimension table (for SQL queries) when the report is created. Trying to display a report outside these limitations results in the report being truncated at the above limits. There are no limits when exporting a report. For information on the report tables, see Analysis/Reporting Schema.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[C++]

The pvResult parameter contains valid data only if the method completes successfully.

[Visual Basic]

Example

' oReportRenderer is a Commerce ReportRenderer object

' Display a static SQL report

   oReportRenderer.Init("7|DRIVER={SQL Server};" _
    & "SERVER=MyServer;DATABASE=Retail_dw; Integrated Security='SSPI'" _
    & "||||10/01/2000 3:45:56 pm" )

' Export a static SQL report

   oReportRenderer.Init("7|DRIVER={SQL Server};SERVER=MyServer;" _
    & "DATABASE=Retail_dw;UID=sysadmin;PWD=123;||Provider=SQLOLEDB;" _
    & "Persist Security Info=False; Integrated Security='SSPI';" _
    & "Initial Catalog=Retail_commerce;Data Source=MyServer;|" _ 
    & "OutPutTableName|10/01/2000 3:45:56 pm")

' Display a static MDX report

   oReportRenderer.Init("19|DRIVER={SQL Server};SERVER=MyServer;" _ 
    & "DATABASE=Retail_dw; Integrated Security='SSPI'" _
    & ";|data source=MyServer;" _ 
    & "Initial Catalog=Retail_dw;|||10/01/2000 3:45:56 pm")

' Export a static MDX report

   oReportRenderer.Init("19|DRIVER={SQL Server};SERVER=MyServer;" _
    & "DATABASE=Retail_dw; Integrated Security='SSPI'" 
    & ";|data source=MyServer;" _
    & Initial Catalog=Retail_dw;|Provider=SQLOLEDB;" _
    & "Persist Security Info=False; Integrated Security='SSPI';" _
    & "Initial Catalog=Retail_commerce;Data Source=MyServer;|" _ 
    & "OutPutTableName|10/01/2000 3:45:56 pm")

See Also

[C++]ReportRenderer Object

[C++]Analysis/Reporting Schema

[C++]Creating Custom Reports

[Visual Basic]ReportRenderer Object

[Visual Basic]Analysis/Reporting Schema

[Visual Basic]Creating Custom Reports

Copyright © 2005 Microsoft Corporation.
All rights reserved.