TARGET Reports' methods and properties for automation

TARGET Reports is the main object for automation purposes. It exposes properties and methods to be used from external programming environments.

The object is exposed through the IReportManager interface.

Properties

db_output

This property indicates whether the resulting reports should be saved into database tables for reporting elements that have the output data source set up.

Read/Write property
Type: boolean

Dim rm
Set rm = CreateObject( "ReportManager.ReportManager.1" )
rm.db_output = true

Methods 

NewProject

Creates a new Target Reports project removing any settings or changes previously done.

Function NewProject()

Parameters:
none

Return value:
none

An exception is thrown in case of errors.

Dim rm
Set rm = CreateObject( "ReportManager.ReportManager.1" )
rm.NewProject() 

OpenProject

Opens a Report project from a file.

Function OpenProject( path )

Parameters:
string path - a file path to a project file location.

Return value:
none

An exception is thrown in case of errors.

Dim rm
Set rm = CreateObject( "ReportManager.ReportManager.1" )
rm.OpenProject( "C:\data\Test.report" )
rm.Run( true ) 

SaveProject

Saves the current Report project to a file.

Function SaveProject( path(optional) )

Parameters:
string path - a file path to a project file location; if this parameter is omitted, the project is saved to the same file it was loaded from.

Return value:
none

An exception is thrown in case of errors. 

Dim rm
Set rm = CreateObject( "ReportManager.ReportManager.1" )
rm.db_output = true
rm.SaveProject( "C:\data\Test.report" )

GetStartPath

Returns a file path to the location from where the TARGET Reports component was started.

Function GetStartPath()

Parameters:
none

Return value:
string - a file path from where the TARGET Reports component was started.

An exception is thrown in case of errors.
 

Dim rm, path
Set rm = CreateObject( "ReportManager.ReportManager.1" )
path = rm.GetStartPath()

GetWorkPath

Returns the path to the TARGET Reports component's working folder.

Function GetWorkPath()

Parameters:
none

Return value:
string - a TARGET Reports component's path to a working folder.

An exception is thrown in case of errors.
 

Dim rm, path
Set rm = CreateObject( "ReportManager.ReportManager.1" )
path = rm.GetWorkPath()

SetViewer

Sets the viewer to be used to visualize the reporting results.

Function SetViewer( viewer )

Parameters:
string viewer - viewer type; acceptable values: RTF, PDF, HTML

Return value:
none

An exception is thrown in case of errors.
 

Dim rm
Set rm = CreateObject( "ReportManager.ReportManager.1" )
rm.SetViewer( "RTF" )

SetOutputPath

Sets the file location and an output format for a final report.

Function SetOutputPath( format, path )

Parameters:
string format - output format for the final document; acceptable values: RTF, PDF, HTML, XML Includable HTML.  Includable HTML prepares HTML that can be inserted into another HTML page.
string path - a file path to a location where the output is to be saved.

Return value:
none

An exception is thrown in case of errors.
 

Dim rm
Set rm = CreateObject( "ReportManager.ReportManager.1" )
rm.SetOutputFormat( "PDF", "C:\data\test.pdf" )

Run

Starts the report generation process.

Function Run( show )

Parameters:
boolean show - set this parameter to true to show the resulting report in the current viewer after the process finishes; false otherwise.

Return value:
boolean - true if the operation succeeded, false otherwise.

An exception is thrown in case of errors.
 

Dim rm
Set rm = CreateObject( "ReportManager.ReportManager.1" )
rm.OpenProject( "C:\data\Test.report" )
rm.Run( true )

RunGetStream

Starts the report generation process and returns the resulting report as a stream for further manipulations.

Function RunGetStream( format )

Parameters:
string format - output format for the final document; acceptable values: HTML, XML, Includable HTML.  Includable HTML contains HTML format ready to be inserted into other HTML code.

Return value:
string - stream with an output document.

An exception is thrown in case of errors.
 

Dim rm, out
Set rm = CreateObject( "ReportManager.ReportManager.1" )
rm.OpenProject( "C:\data\Test.report" )
out = rm.RunGetStream( "INCLUDABLE HTML" )

GetRSetup

Returns IRSetup interface corresponding to one of the reporting elements.

Function GetRSetup( name )

Parameters:
string name - name of a reporting element for which to get an interface.

Return value:
IRSetup - an object representing a reporting element returned by name.

An exception is thrown in case of errors.
 

Dim rm, r_setup
Set rm = CreateObject( "ReportManager.ReportManager.1" )
rm.OpenProject( "C:\data\Test.report" )
Set r_setup = rm.GetRSetup( "Report1" )


Comments