This topic introduces the basic procedures in creating a SimpleReport program.
|
NOTE |
The program example used throughout this section is called SimpleReport. The SimpleReport program generates a Customer report using the Customers file located in the SQLDEMO account. |
Select Library > New in the Libraries window.
Type Report1.lbv in the File name text box, then click OK.
The new Library is now called Report1.lbv. The REPORT1 displays in the Libraries window.

Click New Library from the Studio Browser.
Drag the mvD window from the Component Store to the REPORT1 Library window.
The mvD window component becomes an mvD window Class.
Type wWindow1 to name the mvD window Class.
Repeat procedures 2 and 3, but now drag mvD report from the Component Store to the REPORT1 Library.
The mvD report component becomes an mvD report Class.
Type rReport1 to name the mvD report Class.
The REPORT1 Library displays three Classes:
Startup_Task
wWindow1
rReport1
Double-click rReport1 in the REPORT1 Library.
The REPORT1.rReport1 design form displays.
Drag the Entry field from the Component Store to the rReport1 design form.
Repeat this process to add additional Entry fields to the design form.
Drag the Label Background Object from the Component Store to the REPORT1.rReport1 design form.
Repeat this process to add additional Labels to the design form.
Type the names of the Labels in the Property Manager text field.
|
NOTE |
Entry fields from the Component Store do not need to be named. |

Select MyServer (Default) > Subroutines > mvDReport from the Enterprise Browser and right-click the bp node.
Select Create New Item…, then type SimpleReport to name the new item.
Double-click the SimpleReport node to display the SimpleReport’s BASIC program Editor with the standard template code.

Type the Category name in the SimpleReport’s BASIC program Editor.
<CAT>Report Tutorial</CAT>
Type a DataName for each Entry field to be printed on the report.
<DNAME>fCustomer.ID</DNAME>
<DNAME>fCustomer.Name</DNAME>
<DNAME>fCustomer.Phone</DNAME>
Click Extract to create the DataName node in the Enterprise Browser (as well as save the program).
|
NOTE |
Report DataNames have the same structure as list DataNames, where each field is a column of a list. |
Select MyServer (Default) > DataNames > SimpleReport > fCustomer node from the Enterprise Browser.
The fCustomer node (where the f prefix represents a field) displays three column DataName elements that were created above:
ID
Name
Phone
Drag the DataNames (for example, ID, Name, Phone, and so on) to the corresponding Entry fields on the report design form.
Each time a DataName is dragged to an Entry field, an Event window displays to show the DataName being dropped and its data type.
Click Update to accept the default settings.
|
NOTE |
The Entry field name changes to display the DataName that was dropped on the prefix with iMvdDataRef. iMvdDataRef is the internal Omnis Studio instance variable that holds the print data. This variable is internal and cannot be changed. |
Select MyServer (Default) > Subroutines node from the Enterprise Browser.
The Subroutine SimpleReport BASIC program Editor displays.
Edit the SimpleReport BASIC program’s first CASE instruction.
The print data is returned to the form through the form’s $getreportdata event. The CASE statement branches to the CreateSimpleReport Label if the event is $getreportdata from the REPORT1.rReport1 design form.
The CreateSimpleReport routine opens and selects the CUSTOMERS file from the SQLDEMO account and loops through the selected list to build the report data. Once the loop is completed, w3mvDInsert sends the print data to the report.

Click Compile.
The SimpleReport BASIC program successfully compiles.
|
NOTE |
The program must be cataloged before running. |
Select MyServer (Default) > Subroutines > mvDReport node from the Enterprise Browser.
Right-click SimpleReport and select Catalog Item…
The mvDCatalog Entry window displays.
Select the Allow Anonymous Access check box.
(Optional) Type a description in the Description field, then click Save.
Select MyServer (Default) > mvDCatalog > ReportTutorial > SimpleReport from the Enterprise Browser.
Drag the SimpleReport to the REPORT1.rReport1 design form.
The rReport1 event window displays.
Select the $getreportdata event check box, then select the server name from the Server drop-down list (for example, MyServer).
Click Update to save changes.
Click Print to Screen to run and test the report from the report design form.
If data is not returned, the report does not run. If data is returned from the BASIC program, the run-time report form opens and displays the report.
The report can be run from any one of these options:
Push button
Menu
Toolbar
BASIC program
Remote form
Double-click wWindow1 Class from the REPORT1 Library.
The REPORT1.wWindow1 design form displays.
Drag the Push Button from the Component Store to the REPORT1.wWindow1 design form, then type Print Report in the Text field of the Property Manager window.
The Push Button now displays Print Report.
|
NOTE |
The Push Button component does not require a name. |
Select MyServer (Default) > Reports > REPORT1.rReport1 node from the Enterprise Browser.
The Reports node displays all the mvDesigner reports for all currently opened Libraries.
LibraryName.ReportClassName
where LibraryName is the name of the Library and ReportClassName is the name of the Report Class. For example, REPORT1.rReport1.
Drag the REPORT1.rReport1 node to the Print Report button on the design form.
The wWindow1_1019 event window displays.
Select the evClick Event and the Start New Print Job check boxes, then select Prompt from the Print Destination drop-down list.
|
NOTE |
If a Print Destination (other than Prompt or nothing at all) is selected, click the Push button. The report automatically prints to the selected destination. |
Click Update to save changes.
The Start New Print Job check box must be selected for all new print jobs. The only time when this option should not be selected is when it is a continuing print job. For example, when printing a large report it is a good idea to print the report in batches.
The Print in Batches option is used to specify that the print data that is returned by this BASIC program is not the complete print data and that after this batch more data is available. This tells the mvDesigner Client that once the current data is printed, it needs to go back to the BASIC program to retrieve more data.
|
NOTE |
Batch printing requires that the BASIC program be a persistent connection application. |
Double-click wWindow1 Class to open the REPORT1.wWindow1 design form.
Right-click and select Open Window.
The REPORT1.wWindow1 design form runs.
Click Print Report to open the Print Destination window, then double-click Screen to print the report.
Drag the mvD menu from the Component Store to the REPORT1 Library, then define the field properties for the mvD menu Class using the Property Manger:
Type mPrint in the Name field.
Type Print in the Title field.
Double-click mPrint Class to open the REPORT1.mPrint design form, then press Enter.
A menu option displays on the design form.
Type Print Customer List in the menu option.
Select MyServer (Default) > Reports > REPORT1.rReport1 node from the Enterprise Browser, then drag the REPORT1.rReport1 node to the Print Report button on the design form.
The mPrint_1001 window displays.
Select the evClick event and the Start New Print Job check boxes, then select Prompt from the Print Destination drop-down list.
Click Update to save changes.
Select kTrue from the hasmenus drop-down list, then Select mPrint from the menunames drop-down list to define the field properties for the REPORT1.wWindow1 Class.
Double-click wWindow1 Class to open the design form, then right-click the design form and select Open Window.
The Window REPORT1.wWindow1 design form runs.
Select Print > Print Customer List from the window’s menu.
The Report Destination window displays.
Double-click Screen to print the report, then click OK.
Drag the mvD toolbar from the Component Store to the REPORT1 Library.
Type tbPrint to name the mvD toolbar Class.
Double-click tbPrint Class to open the REPORT1.tbPrint design form.
Drag the Push Button from the Component Store to the tbPrint design form, then type Print Customer List in the Property Manager tooltip field.
Select MyServer (Default) > Reports > REPORT1.rReport1 node from the Enterprise Browser, then drag the REPORT1.rReport1 node to the Print Report button on the design form.
The tbPrint_1001 event window displays.
Select the evClick Event and the Start New Print Job check boxes, then select Prompt from the Print Destination drop-down list.
Click Update to save changes.
Double-Click wWindow1 Class to open the design form.
Select any of these options from the Property Manager toolbarpos drop-down list to define the field properties for the REPORT1.wWindow Class:
kDockingAreaTop
kDockingAreaBottom
kDockingAreaLeft
kDockingAreaRight
Type tbPrint in the Property Manager toolbarnames field.
Right-click the REPORT1.wWindow1 design form and select Open Window.
The REPORT1.wWindow1 design form runs.
Click OK to open the Report Destination window, double-click Screen, then click OK to print.
Drag the Push Button from the Component Store to the REPORT1.wWindow1 Class design form.
Type btprint in the Property Manager Name field and Print from BASIC in the Text field.
Select MyServer (Default) > mvDCatalog > ReportTutorial > SimpleReport node from the Enterprise Browser, then drag the SimpleReport node to the Print from BASIC button.
The btPrint event window displays.
Select the evClick Event and the Start New Print Job check boxes, then click Update to save changes.
Select MyServer (Default) > Subroutines > mvDReport > SimpleReport node from the Enterprise Browser.
Double-click the SimpleReport node to open the BASIC Editor.
Type the CASE statement to handle the evClick Event of the btPrint Object to update the SimpleReport BASIC program.
CASE TRIGGEROBJECT = "btPrint" AND TRIGGEREVENT = "evClick"
GOSUB StartPrint
Type w3mvDPropertyChange to run the $cinst.$openreport in the StartPrint Label.
StartPrint:
CALL W3MVDPROPERTYCHANGE("$$cinst","$openreport(’REPORT1’, ’rReport1’,1,’kDevScreen’)","...")
RETURN

where:
|
LibraryName |
is the name of the library where the report is stored. |
|
ReportName |
is the name of the report to print. |
|
Print Options |
1—Print entire report |
|
0—Print in batch | |
|
PrintDestination |
kDevClipboard |
|
kDevFile | |
|
kDevHtml | |
|
kDevPostscript | |
|
kDevPreview | |
|
kDevPrinter | |
|
kDevRtf | |
|
kDevScreen |
Click compile.
The SimpleReport BASIC program successfully compiles.
Double-click wWindow1 Class to open the REPORT1.wWindow1 design form, then right-click and select Open Window.
The REPORT1.wWindow1 design form runs.
Click Print from BASIC to print the report.
Drag the mvD remote form from the Component Store to the Report1 Library, then type rfForm in the Name field of the Property Manager window.
Double-click rfForm Class to open the design form, then drag the Push Button from the Component Store to the design form.
Type btPrintReport in the Name field, then type Print Report in the Text field to define the field properties for the REPORT1.rfForm Class.
Drag the Print Control from the Component Store to the remote form (resize the Print Control component, if needed.)
Do the following to define the field properties for the Print Control using the Property Manager window:
Type MyPrintControl in the Name field in the General tab.
(Optional) Select Kborderinset from the effects drop-down list in the Appearance tab.
Select MyServer (Default) > Reports > REPORT1.rReport1 node from the Enterprise Browser, then drag the REPORT1.rReport1 node from the Enterprise Browser to the Print Report button.
The btPrintReport event window displays.
Select the evClick event and the Start New Print Job check boxes, then select Prompt from the Print Destination drop-down list and MyPrintControl from the Print Field drop-down list.
Click Update to save the changes.
Double-click wWindow1 Class to open the design form, then right-click and select Test Form.
The default Browser starts the remote form.
Click Print Report to display the report in the Print Control.
|
NOTE |
The Print Control is required to exist on the remote form in order to generate reports. However, the Print Control does not need to be visible if the Print Destination is set to Printer. In this case, the report is automatically sent to the local printer. |
See Also
Generating Report in mvDesigner
Setting up the Development Environment
Using the Report Graph Control Component