I am a new foxpro programmer. Recently I am having a problem with using "scan..for..endscan".
I am working with 2 tables, the 1st one is called criteria, which contains item_name, sumfv(the total value of the fv column in the 2nd table based on different conditions), and a condition column used to store these conditions; the 2nd table is called data, which contains the raw data, including a fv column.I need to extract data from 2nd table based on the conditions from 1st table, then add fv in the 2nd one to the sumfv column in criteria table(1st one).
part of my code is as below:
....
SELECT criteria
GO TOP
SCAN
SELECT data
CALCULATE SUM(fv) FOR AllTRIM(criteria.condition) TO sum
SELECT criteria
REPLACE sumfv WITH sum
ENDSCAN
....
However, when I run this program, it pops up an error message saying FOR should be used with a logical expression. The data type I set for criteria.condition is character..Does anyone know how to fix this problem?
I really appreciate your help!!
Thanks!
I am working with 2 tables, the 1st one is called criteria, which contains item_name, sumfv(the total value of the fv column in the 2nd table based on different conditions), and a condition column used to store these conditions; the 2nd table is called data, which contains the raw data, including a fv column.I need to extract data from 2nd table based on the conditions from 1st table, then add fv in the 2nd one to the sumfv column in criteria table(1st one).
part of my code is as below:
....
SELECT criteria
GO TOP
SCAN
SELECT data
CALCULATE SUM(fv) FOR AllTRIM(criteria.condition) TO sum
SELECT criteria
REPLACE sumfv WITH sum
ENDSCAN
....
However, when I run this program, it pops up an error message saying FOR should be used with a logical expression. The data type I set for criteria.condition is character..Does anyone know how to fix this problem?
I really appreciate your help!!
Thanks!