Thanks in advance for any replies.

Is the REPORT command modal when it is issued without NOWAIT modal?

What I mean is if I have the following code:

1. SELECT CLIENTS
2. SCAN
3. SELECT * FROM INVOICES WHERE CLIENTNUM = CLIENTS.CLIENTNUM INTO
CURSOR CLIENTINVOICES
4. SELECT CLIENTINVOICES
5. REPORT FORM INVOICEREPORT TO PRINTER NOCONSOLE
6. SELECT CLIENTS
7. ENDSCAN

Does the report finish processing before line 6 is executed?

This seems to me to be a basic and obvious question but I have some code
that is essentially the same as the code above and sometimes the first
report is failing with a "Variable Not Found" error for a variable that is
in the query. The other reports are printing correctly.

Previously I had this code being called from a form with a private data
session and the error occurred every time. I was advised to change the form
to use the default data session. At first I thought this had solved the
problem but what I've discovered is that the problem still occurs but only
about 1 in 10 times instead of every time.

Also the code is contained in a PRG that is being called from a menu. When I
ran the code with the debugger on it never failed. Also when I ran the code
from a button on the form instead of from a menu on the form it didn't fail.

If anyone has any clues as to what is going on here I'd appreciate hearing
about it.

Thanks,

Jeff

Re: Are Report Commands Modal? by Eric

Eric
Wed Jan 28 12:59:56 CST 2004

Hello, Jeff!

I don't see anything in the code that could raise the Variable Not Found
error. It must be a textbox or some kind of expression in your report if you
ask me. When I run into problems like this, I do the following:

- run SQL to retrieve required data
- open report file in report designer
- from within the report designer, send the report to a print preview

If you're lucky (and you probably are), the report designer will open the
faulty field/expression in the Expression dialog box.

Just another thing. Why are you running this report in a SCAN loop? Wouldn't
it be easier to create a grouped report? The first step is to combine the
SCAN and the SQL:

SELECT invoices.*, clients.required_fields ;
FROM INVOICES ;
WHERE invoices.CLIENTNUM = CLIENTS.CLIENTNUM ;
INTO CURSOR CLIENTINVOICES
IF _tally > 0
REPORT FORM INVOICEREPORT TO PRINTER NOCONSOLE
ELSE
* no data to print
ENDIF

Just a thought.
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: Are Report Commands Modal? by Eric

Eric
Wed Jan 28 14:13:23 CST 2004

Just a quick fix...

EdD> SELECT invoices.*, clients.required_fields ;
EdD> FROM INVOICES ;
EdD> WHERE invoices.CLIENTNUM = CLIENTS.CLIENTNUM ;
EdD> INTO CURSOR CLIENTINVOICES

Should read:

SELECT invoices.*, clients.required_fields ;
FROM INVOICES, clients ;
WHERE invoices.CLIENTNUM = CLIENTS.CLIENTNUM ;
INTO CURSOR CLIENTINVOICES

--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: Are Report Commands Modal? by Jeff

Jeff
Wed Jan 28 16:11:30 CST 2004

Hello Eric,

Thanks for the reply. I over simplified the example a little but to answer
your question about why I use the scan loop:

My users are processing transactions for a variety of clients. When they are
done I need print a report for each client showing the processed
transactions. I need two copies of the report and they should be together. I
do the following:

SELECT DISTINCT CLIENTCODE FROM TRANS WHERE PROCESSED INTO CURSOR CLIENTLIST
&& TO GET A LIST OF CLIENTS
SELECT CLIENTLIST
SCAN
* GET TRANSACTIONS FOR CLIENT
SELECT * FROM TRANS WHERE CLIENTCODE = CLIENTLIST.CLIENTCODE AND
PROCESSED INTO CURSOR CLIENTTRANS
SELECT CLIENTTRANS
REPORT FORM TRANSREPORT TO PRINT NOCONSOLE && FIRST COPY
REPORT FORM TRANSREPORT TO PRINT NOCONSOLE && SECOND COPY
SELECT CLIENTLIST
ENDSCAN

This code which is contained in a separate PRG is still a little simplified
from the production code but not much. As I said before I get the following
strange results:

1. Run from menu on form with private data session The first report
(for the first client) gets the Variable Not Found error every time
2. Same as above but with the debugger running Works every time
3. Run from a button on a form with private data session Seems to work
4. Run from menu on form with default data session Works most of the
time
5. Run from the command box in the IDE Seems to work

I am currently using option number 4 in my production code and it is failing
once in a while. The failure rate is so low (about 1 out of 10) that I can't
really say that options 2, 4, and 5 which seem to work wouldn't also fail 1
out of 10 times.

Just to be complete about the description everything is built using VFP 7.0
SP1

The need for two sequential copies of the report is the reason that I didn't
use the method you outlined.

Thanks again.

Jeff

"Eric den Doop" <ericdendoop@xspamblockxfoxite.com> wrote in message
news:OJ4%23tDd5DHA.1428@TK2MSFTNGP12.phx.gbl...
> Hello, Jeff!
>
> I don't see anything in the code that could raise the Variable Not Found
> error. It must be a textbox or some kind of expression in your report if
you
> ask me. When I run into problems like this, I do the following:
>
> - run SQL to retrieve required data
> - open report file in report designer
> - from within the report designer, send the report to a print preview
>
> If you're lucky (and you probably are), the report designer will open the
> faulty field/expression in the Expression dialog box.
>
> Just another thing. Why are you running this report in a SCAN loop?
Wouldn't
> it be easier to create a grouped report? The first step is to combine the
> SCAN and the SQL:
>
> SELECT invoices.*, clients.required_fields ;
> FROM INVOICES ;
> WHERE invoices.CLIENTNUM = CLIENTS.CLIENTNUM ;
> INTO CURSOR CLIENTINVOICES
> IF _tally > 0
> REPORT FORM INVOICEREPORT TO PRINTER NOCONSOLE
> ELSE
> * no data to print
> ENDIF
>
> Just a thought.
> --
> Eric den Doop
> www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8
>
>



Re: Are Report Commands Modal? by Cindy

Cindy
Wed Jan 28 16:24:56 CST 2004

In news: 101fq7j3t044tdb@news.supernews.com,
Jeff Grippe <jeff@door7> wrote:
> 1. SELECT CLIENTS
> 2. SCAN
> 3. SELECT * FROM INVOICES WHERE CLIENTNUM = CLIENTS.CLIENTNUM
> INTO CURSOR CLIENTINVOICES
> 4. SELECT CLIENTINVOICES
> 5. REPORT FORM INVOICEREPORT TO PRINTER NOCONSOLE
> 6. SELECT CLIENTS
> 7. ENDSCAN

Just a comment - Immediately after your SELECT ClientInvoices is the current
work area so line 4 isn't necessary. Also, from the Help: "SCAN ... ENDSCAN
ensures that, upon reaching ENDSCAN, Visual FoxPro reselects the table that
was current when the SCAN ... ENDSCAN loop began." so line 6 isn't necessary
either.

You might want to check that matching records were actually selected - try
IF _TALLY > 0... ENDIF surrounding your REPORT statement.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden@mvps.org www.cindywinegarden.com




Re: Are Report Commands Modal? by Jeff

Jeff
Wed Jan 28 19:24:43 CST 2004

Cindy,

Thanks. I had a feeling that those select statements weren't necessary but I
hail from days before there was SQL in Fox and before there was
SCAN/ENDSCAN. If I don't put them in the code I just don't feel good about
it.

It is unlikely (although not impossible) for the second query to return no
records since it is based on the first query which did return records. I
guess that if the second query failed for some reason then I would be left
without the correct table being pointed to and it would only happen during
the first query. I would expect an error on the select statement before the
report statement, however.

Thanks again,

Jeff
"Cindy Winegarden" <cindy.winegarden@mvps.org> wrote in message
news:%230eCA6e5DHA.1368@TK2MSFTNGP10.phx.gbl...
> In news: 101fq7j3t044tdb@news.supernews.com,
> Jeff Grippe <jeff@door7> wrote:
> > 1. SELECT CLIENTS
> > 2. SCAN
> > 3. SELECT * FROM INVOICES WHERE CLIENTNUM = CLIENTS.CLIENTNUM
> > INTO CURSOR CLIENTINVOICES
> > 4. SELECT CLIENTINVOICES
> > 5. REPORT FORM INVOICEREPORT TO PRINTER NOCONSOLE
> > 6. SELECT CLIENTS
> > 7. ENDSCAN
>
> Just a comment - Immediately after your SELECT ClientInvoices is the
current
> work area so line 4 isn't necessary. Also, from the Help: "SCAN ...
ENDSCAN
> ensures that, upon reaching ENDSCAN, Visual FoxPro reselects the table
that
> was current when the SCAN ... ENDSCAN loop began." so line 6 isn't
necessary
> either.
>
> You might want to check that matching records were actually selected - try
> IF _TALLY > 0... ENDIF surrounding your REPORT statement.
>
> --
> Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
> cindy.winegarden@mvps.org www.cindywinegarden.com
>
>
>



Re: Are Report Commands Modal? by Wolfgang

Wolfgang
Thu Jan 29 16:55:56 CST 2004

Hello Jeff!

Just a thought! Why don't you set up a relation between the cursor with the
processed clients (clientlist) and the trans.dbf and then run a grouped
report on this relationed data?
To get 2 copies just open the FRX-file and patch the Copies Entry to 2

--
_________________

MFG
Wolfgang Schmale

MS Visual FoxPro MVP

--------------------------------
"Jeff Grippe" <jeff@door7> schrieb im Newsbeitrag
news:101gcsis2cf5q7c@news.supernews.com...
> Hello Eric,
>
> Thanks for the reply. I over simplified the example a little but to answer
> your question about why I use the scan loop:
>
> My users are processing transactions for a variety of clients. When they
are
> done I need print a report for each client showing the processed
> transactions. I need two copies of the report and they should be together.
I
> do the following:
>
> SELECT DISTINCT CLIENTCODE FROM TRANS WHERE PROCESSED INTO CURSOR
CLIENTLIST
> && TO GET A LIST OF CLIENTS
> SELECT CLIENTLIST
> SCAN
> * GET TRANSACTIONS FOR CLIENT
> SELECT * FROM TRANS WHERE CLIENTCODE = CLIENTLIST.CLIENTCODE AND
> PROCESSED INTO CURSOR CLIENTTRANS
> SELECT CLIENTTRANS
> REPORT FORM TRANSREPORT TO PRINT NOCONSOLE && FIRST COPY
> REPORT FORM TRANSREPORT TO PRINT NOCONSOLE && SECOND COPY
> SELECT CLIENTLIST
> ENDSCAN
>
> This code which is contained in a separate PRG is still a little
simplified
> from the production code but not much. As I said before I get the
following
> strange results:
>
> 1. Run from menu on form with private data session The first report
> (for the first client) gets the Variable Not Found error every time
> 2. Same as above but with the debugger running Works every time
> 3. Run from a button on a form with private data session Seems to work
> 4. Run from menu on form with default data session Works most of
the
> time
> 5. Run from the command box in the IDE Seems to
work
>
> I am currently using option number 4 in my production code and it is
failing
> once in a while. The failure rate is so low (about 1 out of 10) that I
can't
> really say that options 2, 4, and 5 which seem to work wouldn't also fail
1
> out of 10 times.
>
> Just to be complete about the description everything is built using VFP
7.0
> SP1
>
> The need for two sequential copies of the report is the reason that I
didn't
> use the method you outlined.
>
> Thanks again.
>
> Jeff
>
> "Eric den Doop" <ericdendoop@xspamblockxfoxite.com> wrote in message
> news:OJ4%23tDd5DHA.1428@TK2MSFTNGP12.phx.gbl...
> > Hello, Jeff!
> >
> > I don't see anything in the code that could raise the Variable Not Found
> > error. It must be a textbox or some kind of expression in your report if
> you
> > ask me. When I run into problems like this, I do the following:
> >
> > - run SQL to retrieve required data
> > - open report file in report designer
> > - from within the report designer, send the report to a print preview
> >
> > If you're lucky (and you probably are), the report designer will open
the
> > faulty field/expression in the Expression dialog box.
> >
> > Just another thing. Why are you running this report in a SCAN loop?
> Wouldn't
> > it be easier to create a grouped report? The first step is to combine
the
> > SCAN and the SQL:
> >
> > SELECT invoices.*, clients.required_fields ;
> > FROM INVOICES ;
> > WHERE invoices.CLIENTNUM = CLIENTS.CLIENTNUM ;
> > INTO CURSOR CLIENTINVOICES
> > IF _tally > 0
> > REPORT FORM INVOICEREPORT TO PRINTER NOCONSOLE
> > ELSE
> > * no data to print
> > ENDIF
> >
> > Just a thought.
> > --
> > Eric den Doop
> > www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8
> >
> >
>
>