Subject |
Re: Preview.wfm and report printing |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Sat, 28 Oct 2023 11:38:00 +0200 |
Newsgroups |
dbase.getting-started |
On 2023/10/25 15:03, Michael Italiano wrote:
> Hi Trevor,
>
> I have used 2 methods to get around passing data from a main file to a report.
>
> 1. I create a second table with the date range result to be used in the report. eg: a= "tablea.dbf, b="temptable.dbf"
>
> Use &a
> COPY TO &b for (tdate => rp_date1 .AND. tdate <= rp_date2)
>
> Then use table b for your report
Back in the days of dBASE II and dBASE III, where reports used @ SAY to
stream content out line by line, that was the way to go. It took some
very fancy footwork to change a report's output on-the-fly. A temporary
table was easiest way to change the record selection for a report.
Things changed with the advent of OODML in dBASE. A WHERE clause, with
parameters, in the report's query object obviates the need to create a
temporary table.
Instead of a form to accept two dates, and perhaps a department code,
which then creates a temporary table we can now create a form to create
an instance of the report in memory. One can now pass values to the
query's parameters within the report and then requery(), in memory, to
fetch the required records. One can also set ANY property in the report
to a new value. This means one can change a heading, select a printer,
decide to either print on screen or to a selected printer, set the
number of copies to print and so on. It means that instead of having
many reports that produce almost, but not quite, identical output we can
now have one report that can be tailored at runtime.
If it works, it's not wrong. :-) I'm not suggesting that you change
any of your existing code. One does, however, always need to bear in
mind that there may be a better way for future use.
> 2. Create public variables for your date range and set them in your main file. Also create a public variable for your sql statement. Assign your sql statement in your main file with your variables as your date range selected then in your report replace your sql statement with the string created in your main file. You can only do this via the text editor otherwise the sql statement gets over written.
>
> I dont think it matters which version Dbase you use, using these two methods.
Public variables have their place but there is a school of thought that
they, and user-defined properties which do the same thing in OODML,
should only be used as a last resort.
Mervyn.
|
|