Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
APPEND FROM [SQL Cursor]
Message
From
23/12/2008 08:46:25
 
 
To
23/12/2008 03:18:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01369081
Message ID:
01369332
Views:
30
>Please show us the actual code, without any changes. Your code should work as shown, so it must be something in the code which you don't show.

Hi Tore,
Ok, here it is.
Unfortunately, UT is reformatting it (taking all the leading spaces out) so it's a little hard to read. (Is there any way to for me to post code or other text and prevent UT from removing the leading spaces in each line?)
The work is done in three steps. In step 3, it fails. The code that fails is shown and it is commented out. The workaround is shown also, and it is working properly.
Let me know if you see anything that could be causing the problem. Thanks.
Best regards, Chaim


* step 1--Agg Type 1: aggregate deductions by employee by GL account
SELECT;
ADeduct.iEmp,;
LUGLActD.cAccount AS cAcctCode,;
MAX(LUGLActD.cText) AS cAcctDesc,;
SUM(ADeduct.yDeduct) AS yDeduct,;
MAX(Employee.cNameLast) AS cNameLast,;
MAX(Employee.cNameFrst) AS cNameFrst,;
MAX(Employee.cNameMI) AS cNameMI;
FROM ADeduct JOIN Employee ON Employee.iPK = ADeduct.iEmp;
JOIN LUDeduct ON LUDeduct.iPK = ADeduct.iDeduct;
JOIN DedCmpny ON LUDeduct.iPK = DedCmpny.iDeduct;
JOIN LUGLActD ON LUGLActD.iPK = DedCmpny.iGLAcct;
GROUP BY 1,2;
WHERE ADeduct.iRun = ThisForm.iRun AND;
LUDeduct.cAggType = "1" AND;
LUDeduct.lGL AND;
DedCmpny.iCompany = ThisForm.iCompany;
INTO CURSOR CuDed1EmpGLA NOFILTER READWRITE

* step 2--Agg Type 1: aggregate cursor CuDed1EmpGLA by employee
IF lnTallyCuDed1GLA > 0

SELECT;
iEmp,;
MAX(UPPER(cNameLast + cNameFrst + cNameMI));
AS cNameSort,;
MAX(cNameLast) AS cNameLast,;
MAX(cNameFrst) AS cNameFrst,;
MAX(cNameMI) AS cNameMI,;
SUM(yDeduct) AS yDeduct,;
MAX("1") AS cAggType;
FROM CuDed1EmpGLA;
GROUP BY 1;
INTO CURSOR CuDed1Emp READWRITE NOFILTER
lnTallyCuDed1Emp = _TALLY

ENDIF && lnTallyCuDed1GLA > 0

* step 8--Agg Type 1: copy CuDed1Emp to CuDedEmp
IF lnTallyCuDed1Emp > 0

* following is the code that fails
*!* SELECT CuDedEmp
*!* APPEND FROM (DBF("CuDed1Emp"))

* following is the workaround
SELECT CuDed1Emp
SCAN
INSERT INTO CuDedEmp;
(iEmp,;
cNameLast,cNameFrst,cNameMI,;
yDeduct,cAggType);
VALUES;
(CuDed1Emp.iEmp,;
CuDed1Emp.cNameLast,CuDed1Emp.cNameFrst,CuDed1Emp.cNameMI,;
CuDed1Emp.yDeduct,CuDed1Emp.cAggType)
ENDSCAN
ENDIF && lnTallyCuDed1Emp > 0
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform