Open (Method)

Applies To:

Connection object, MetaDataConnection object, Documents collection

Description:

Documents—Opens an existing Interactive Reporting document file (BQY).

Connection—Opens an existing Interactive Reporting database connection file (OCE).

Note:

The Documents.Open() object model syntax is not supported in an Interactive Reporting document file to be deployed in EPM Workspace.

Syntax:

Expression.Open(Filename As String)

Expression Required:

An expression that returns a Connection, or Documents object

Example 1:

This example shows how to open an existing Interactive Reporting document file:

var MyFile = "C:\\BQDocs\\JavaTest.bqy"
var MyDoc = Documents.Open(MyFile)
Alert(MyDoc.Name + " is open")

Example 2:

This example shows how to open an existing Interactive Reporting file (.oce):

var MyOCE = "C:\\BQDocs\\SQL.oce"
ActiveDocument.Sections["Query"].DataModel.Connection.Open(MyOCE)
ActiveDocument.Sections["Query"].DataModel.Connection.Username = "qa"
ActiveDocument.Sections["Query"].DataModel.Connection.SetPassword("qa")
ActiveDocument.Sections["Query"].DataModel.Connection.Connect()

or 

var MyOCE = "C:\\BQDocs\\SQL.oce"
var MyCon = ActiveDocument.Sections["Query"].DataModel.Connection
MyCon.Open(MyOCE)
MyCon.Username = "qa"
MyCon.SetPassword("qa")
MyCon.Connect()