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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

append function appears to give incorrect results 1

Status
Not open for further replies.

bebbo

Programmer
Dec 5, 2000
621
0
0
GB
The statement below gives me the result I would expect should there not be a staff.dbf file. However if there is a staff file it appends all records from the client file. Although there are only 2 records with grp = 1. Any ideas?

IF !FILE("STAFF.DBF")
SELECT DISTINCT Client.sysref, Client.Surname,
Client.FirstName ;
INTO TABLE STAFF ;
FROM CLIENT ;
WHERE CLIENT.GRP = 1 ;
ORDER BY 1
ELSE
IF !USED("CLIENT")
USE CLIENT IN 0
ENDIF
IF !USED("STAFF")
USE STAFF IN 0
ENDIF
SELECT STAFF
DELETE ALL
APPEND FROM CLIENT FOR CLIENT.GRP = 1
ENDIF
 
I have even tried setting a filter on the client file first to grp = 1. Should I view the client file it only shows grp 1. However all records are appended
 
You need only change command
APPEND FROM CLIENT FOR CLIENT.GRP = 1
to
APPEND FROM CLIENT FOR GRP = 1
then program work right
ThuVan
 
That still did not work Variable grpnot found. Therefore in my first select I selected the grp field aswell. Changing client.grp to grp then worked. Thanks.
 
I'm sorry, You are all right:
The table STAFF need have field GRP:
SELECT DISTINCT Client.sysref, Client.Surname,
Client.FirstName, Client.GRP ;
INTO TABLE STAFF ;
FROM CLIENT ;
WHERE CLIENT.GRP = 1 ;
ORDER BY 1

then program work right

ThuVan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top