Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Desired Results Not Received on Report From RQBE 1

Status
Not open for further replies.

JmichaelSR

Programmer
Mar 17, 2004
15
US
I am a COBOL mainframe programmer with 35 years of experience who has been given the task of generating some reports using FoxPro 2.5. I am totally new to FoxPro and am hoping there is someone out there who can show me the error of my ways.

The Problem:
I am using the FoxPro routine 'RQBE' to generate
a very simple report. I am accessing two DBF files and
extracting from them only six fields with which to
populate a report. One of the six fields printed,
'Sched.location', does not reflect the information
expected. ALL RECORDS printed reflect the
Sched.location value of the FIRST RECORD IN THE SCHED
FILE. All other information is being pulled from the
correct records.

Please take a look at the code listed below.
What is causing the SCHED.LOCATION to always be taken
from the first record of the Sched.dbf file? What
should I do to correct?

Any help or suggestions you can give will be greatly
appreciated. Thanks in advance.

The Code:

SELECT Crse.crs_name, Sched.year, Sched.county, Sched.dates,;
Sched.location, Sched.month;
FROM Crse, Sched;
WHERE Sched.course_id = Crse.course_id;
AND Sched.notice = CTOD("02/23/04");
INTO CURSOR Notice3q
REPORT FORM notice3.frx TO PRINTER NOCONSOLE


Mike Clark
Programmer/Analyst
Mississippi State Fire Academy
 
Mike,
It would appear the SELECT is correct, so it's more likely the report.

Did you specify the fields on the report to use the table alias? (e.g. Crse.crs_name or sched.location).

They should all be either using Notice3q, or not have any alias specified at all - just the field names, so it uses these values in the records in the cursor.

Rick

 
Agree with RICK and in addition, you might like to temporarily change the "CURSOR" in the statement to DBF to examine / debug the output.

Other option, (less likely), please verify (if not done so already) whether there are indeed multiple records in CRSE and the report is indeed working correctly. (Your ctod("..") could be fetching a different record from the one you tested with).

HTH

End


 
You should work in Foxpto 2.5 with CENTURY set ON, as Foxpro will interpret {02/23/04} as being in 1904

You can change line
AND Sched.notice = CTOD("02/23/04");
to
AND Sched.notice = {02/23/04}
or more correctly
AND Sched.notice = {02/23/2004} when correctly using SET CENTURY ON


 
To: rgbean, ananthap, and cricket

Thank you so much for your help on my problem. Rick, your suggestion to check my field names on the report solved the problem. On the report, I changed 'sched.location' to 'location' and all worked perfectly. I really appreciate the help with my FoxPro education.

Rick, I would like to pass on to you some comments my boss, Jim Ranager, made to me. Jim says that when I reached you, I got a good person for help and that you had helped him resolve many problems in the past.

Tek-Tips is going to be a great tool for me.

Mike Clark
Programmer/Analyst
Mississippi State Fire Academy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top