No Alan - the following code (adapted from Eric) demonstrates exactly what I am doing:
#DEFINE _fields 35 #DEFINE _rows 100 =RAND(-1) CREATE CURSOR crsTest (id i) cCalcCmd = [CALCULATE ] cInsertFields = [] cInsertValues = [] cVariables = [] FOR x = 1 TO _fields cField = "Field"+TRANSFORM(x) ALTER table crsTest ADD COLUMN (cField) I cCalcCmd = cCalcCmd + "SUM("+cField+")," cInsertFields = cInsertFields + ","+cField cInsertValues = cInsertValues + ","+TRANS(INT(RAND()*100)) cVariables = cVariables + "lc"+cField+"," NEXT cInsertCmd = [INSERT INTO crsTest (ID ] + cInsertFields +[) VALUES (0]+cInsertValues+')' FOR X = 1 TO _rows &cInsertCmd NEXT cCalcCmd = Left(cCalcCmd,Len(cCalcCmd)-1) + " To " + Left(cVariables,Len(cVariables)-1) &&+ "AVG(Field1)" ? cCalcCmd &cCalcCmd Return
Paul
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Alan Bourke Sent: 22 November 2019 12:55 To: profoxtech@leafe.com Subject: Re: Fatal error issuing CALCULATE command
Sent by an external sender ------------------------------
Paul
Do you mean you are doing this?
calculate sum(field1 + field2 + ... + field32) to lnTotal
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
[excessive quoting removed by server]