Using DBLaunch

Overview

DBLaunch is part of the Comet Data Express suite of programs. DBLaunch is a subprogram that allows programmers to launch views and reports from within their Internet Basic applications. DBLaunch is released as part of the UTL directory, starting with Version 03.02. The required include file (DBLaunch.inc) is released as part of the XTL directory (the Utility Source Subset).

The interface to DBLaunch is simple. You define the name of the view/report you want to launch, the directory where that view/report is located, and a command to launch Excel, the Crystal Reports viewer, or the Crystal Reports print program. You then print this information to the user buffer, and Enter the DBLaunch subprogram. An error code is returned to your program via the user buffer indicating the success or failure of the launch. The following sample programs demonstrate how to use each of the three options.

DBLaunch requires Comet2003 and a TMP directory.

Launching a View in Excel

To launch a view in Excel:

The following code segment shows how to launch a view in Excel:

Include "DBLaunch.inc"

DB.File$ = "FebruarySales.V00"
DB.Dir$ = "RPT"
DB.Command$ = DB.ExcelView$
Print (#,DB.Launch)
Enter "DBLaunch", DIR="UTL"
Input (#,DB.Result)
If DB.ErrCode NE 0
... display error message returned in DB.Msg$
Endif

Launching a Report Preview in Crystal Reports To launch a report preview in Crystal Reports:

The following code segment shows how to launch a report preview in Crystal Reports:

Include "DBLaunch.inc"

DB.File$ = "CustomerList.RPT"
DB.Dir$ = "RPT"
DB.Command$ = DB.ReportView$
Print (#,DB.Launch)
Enter "DBLaunch", DIR="UTL"
Input (#,DB.Result)
If DB.ErrCode NE 0
... display error message returned in DB.Msg$
Endif

Printing a Report with Crystal Reports To print a report with Crystal Reports:

The following code segment shows how to print a report with Crystal Reports:

Include "DBLaunch.inc"

DB.File$ = "InventoryReport.RPT"
DB.Dir$ = "RPT"
DB.Command$ = DB.ReportPrint$
Print (#,DB.Launch)
Enter "DBLaunch", DIR="UTL"
Input (#,DB.Result)
If DB.ErrCode NE 0
... display error message returned in DB.Msg$
Endif

Include File

For reference purposes, here is the include file for DBLaunch:

!
!	DBLaunch.inc
!	This is the interface include file for use with the DBLaunch sub-program
!

Length	3	&	Local DB.Dir$		! The Comet directory where the .V00 can be found (although it is not in the qdir)
Length	32	&	Local DB.Command$	! Choose one of the commands defined below
Length	254	&	Local DB.File$		! The filename of the .V00 or .RPT file
Length	254	&	Local DB.Msg$		! Error message text

Length	5.0	&	Local DB.ErrCode

! These are the supported values for DB.Command$
Set DB.ExcelView$ = "EXCELVIEW"
Set DB.ReportView$ = "REPORTVIEW"
Set DB.ReportPrint$ = "REPORTPRINT"

! Use this FORMAT to send info to DBLaunch
DB.Launch: Format DB.File$;DB.Dir$;DB.Command$

! Use this FORMAT to get result info from DBLaunch
DB.Result: Format DB.ErrCode;DB.Msg$
! If DB.ErrCode = 0 the launch succeeded
! If DB.ErrCode = 1 the launch failed; Db.Msg$ contains error message