Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
CREATE LABEL
, MODIFY LABEL
, CREATE REPORT
, MODIFY REPORT
These commands open the Label and Report Designers. There’s also a special form of CREATE REPORT
that lets you set up a report without opening the Report Designer.
CREATE LABEL | REPORT [ FileName | ? ]
[ WINDOW DefinitionWindow ]
[ IN [ WINDOW ] ContainerWindow | IN SCREEN
| IN MACDESKTOP ]
[ NOWAIT ] [ SAVE ]
MODIFY LABEL | REPORT [ FileName | ? ]
[ WINDOW DefinitionWindow ]
[ IN [ WINDOW ] ContainerWindow | IN SCREEN
| IN MACDESKTOP ]
[ NOWAIT ] [ SAVE ]
[ NOENVIRONMENT ]
See CREATE FORM
for explanations of the various clauses in the ordinary form of these commands. There’s also a unique form of CREATE REPORT
described below.
CREATE LABEL MyLabel
CREATE REPORT MyReport
CREATE REPORT FileName | ? FROM TableName
[ FORM | COLUMN ] [ FIELDS FieldList ] [ ALIAS ]
[ WIDTH nColumns ] [ NOOVERWRITE ]
This is a pretty cool command. It lets you create a report programmatically without having to actually mess with the FRX table. The reports it creates aren’t nice enough to actually use for anything, but they do provide a good starting point. With a little help from SET FIELDS
, they can also be good enough for a client who wants some very simple ad hoc reporting capabilities. Basically, this form is a command version of the Quick Report option on the Report menu.
There are two types of quick reports. A FORM report has one row per field—it looks like APPEND or EDIT. A COLUMN report has one row per record with a column for each field—it looks like a BROWSE.
There are times when you really need fields in a report to be aliased and other situations where the alias gets in the way. The ALIAS keyword lets you decide which case you have. Including it adds the table’s name to each field in the report. Regardless of whether you specify ALIAS, the named table is placed in the report’s Data environment.
NOOVERWRITE protects you from yourself. If you already have a file with the specified filename, nothing happens. Really, nothing happens—no error message, no new report. Without this clause, but with SAFETY ON, you get prompted if the file exists.
The WIDTH clause is ignored. No matter what value you pass, FoxPro does its own thing and uses as many columns as it thinks you need or as many as fit the current page setup. To control the report's width, you'll have to limit the field list. |
Compile Form, Compile Label, Compile Report, Create Form, Label, Report