Program: Superbase Version: 2.0 Topic: Creating a Report with different output choices than a Report Designer Report Date: January 15, 1993 Summary: This technote shows you how you can create a report quickly and be able to modify the corresponding SBL program so that the report can be sent to a different destination than those available from a Report Designer Report. Although the Superbase 2.0 Report Designer creates an SBL report program file, this program file cannot be modified to the extent similar to the SBP report program file created under the Superbase 4 1.3x Report Generator. This is because a report created in the new Superbase 2.0 Report Designer is now in a graphic based format rather than the text based format used by the Superbase 4 1.3x Report Generator and the new report format requires the opening of the graphic part of the report. Simply put, you cannot simply redirect the output of a report to any other destinations than those given from a report created in the Report Designer. This technote shows a good method to get around this by using the Quick Report function to create the modifiable code. Creating a modifiable report program 1. Before opening your database, select Record from the Program menu. When prompted, type a name for the macro that you would normally give your report i.e. Jan93Rep. Click OK and you are now ready to record your report. 2. Select Open File from the File menu to open up your database. Select your desired database and click OK. If you already have the desired Quick Report created, you can skip this step and move onto step 3. 3. Select Quick Report from the Data menu. 4. Once you are in the Quick Report dialog, either create a report in the manner you wish to or select Open to open a report which you have already created. Don't forget to select a destination if you wish to send it to a destination other than the default destination of Window. Click OK once you have completed your report. 5. If you wish to check out the report you have just completed, wait until the report has finished. Otherwise, you can cancel the report by selecting the Stop button on the control panel or double clicking on the close gadget of the report's window. Either way, the macro is not effected. 6. After the report has finished or you have canceled it, select Stop Recorder from the Program menu to stop recording the macro. 7. To view the new macro, select Edit from the Program menu. You should see something like the following: SUB main() CALL Jan93rep() END SUB SUBJan93rep() : REM Jan/20/1993 DIRECTORY "C:\SB4W20" OPEN FILE "C:\SB4W20\TESTBED.SBF":VIEW SET QUERY HEADING "",0,0 SELECT lastname.TESTBED,firstname.TESTBED,state.TESTBED,payamt.TEST BED REPORT GROUP state.TESTBED COUNT ORDER REPORT lastname.TESTBED TO WINDOW END SELECT END SUB 8. To change the destination of your report, simply replace WINDOW in the line that says "TO WINDOW" with one of the following: ASK Presents a dialog with all available destinations FILE "filename" Superbase database file "filename" ASCII text file PRINTER Printer WINDOW "window name" Window with optional window name Line Omitted Screen like SB4 1.3x reports To send the report to the Clipboard, delete the TO... line and add the keyword COPY to the front of the SELECT fieldname.filename,... line. For further information on modifying this SELECT block, please refer to the SELECT keyword in the SBL Reference Guide. 9. Whenever you wish to run this report, select Run from the Program menu. Make sure that you Save from the File menu when you have completed the report to your liking. 10. If you would like to further modify the Report program, here are some guidelines: a. When adding group blocks such as BEFORE GROUP and AFTER GROUP, make sure that you add the statement GROUP fieldname.filename before the block. Also, make sure that you put the fieldname.filename after the word GROUP. b. Make sure that you put all your additions between the SET QUERY HEADING and SELECT lines. I find it helpful to put the keyword REPORT on a line after the SET QUERY HEADING line. c. If you do make additions to your report, make sure that there are no redundancies in the REPORT line of the SELECT block. An example of this would be a COUNT in both the GROUP groupname.file of the SELECT block and the AFTER GROUP groupname.file block. No error occurs but might make maintenance of this report confusing. The output of these additional blocks suppresses any output of this REPORT line. d. Reading the section on the SELECT keyword in the SBL Reference Guide before making any modifications to the SELECT block is highly recommended. e. For further reading on this subject, refer to Chapter 11, "Using Reports With SBL", in the Developing Applications Guide. This section goes into much detail on this subject.