Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to calculate Grid Sum?
Message
De
03/12/1997 09:00:11
 
 
À
02/12/1997 20:31:32
Shihchau Tai
Apic Systems Pte Ltd
Singapore, Singapour
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00063223
Message ID:
00063546
Vues:
46
>>>I have a grid class (modify from TASTRADE) that calculates Sum of a column but it gives me GPF. If I take out the 'CALCULATE' statement, everything works fine. Is this a Microsoft bug or not?
>>>
>>>My CalExpr is: SUM(carddet_vw.qty*carddet_vw.price)
>>>
>>>
>>>LOCAL i,lnOldArea, ;
>>> lnOldRecNo, ;
>>> luKey, ;
>>> lcOrder,;
>>> lnResult,;
>>> lcExpression
>>>
>>>lnResult = 0.00
>>>IF EMPTY(THIS.CalExpr)
>>> return lnResult
>>>ELSE
>>> IF EMPTY(this.RecordSource)
>>> RETURN lnResult
>>> ENDIF
>>>
>>> lcExpression= " " + THIS.CalExpr + " "
>>> lnOldArea = SELECT()
>>> SELECT (this.RecordSource)
>>> lnOldRecNo = IIF(EOF(), 0, RECNO())
>>> lcOrder = ORDER()
>>> luKey = IIF(!EMPTY(lcOrder), EVAL(lcOrder), "")
>>>
>>> IF !EMPTY(lcOrder) AND SEEK(luKey)
>>> calculate &lcExpression
>>> WHILE luKey = EVAL(lcOrder) ;
>>> TO lnResult
>>> ELSE
>>> CALCULATE &lcExpression
>>> TO lnResult
>>> ENDIF
>>>
>>> IF lnOldRecNo 0
>>> GO lnOldRecNo
>>> ENDIF
>>> SELECT (lnOldArea)
>>>ENDIF
>>>
>>>return lnResult
>>
>>I think it's safer to 'calculate' using SELECT-SQL. Here, you wouldn't worry about work areas, pointers, etc.
>
>
>Can I use SQL-SELECT? Doesn't SQL-SELECT takes value from disk? I am using parameterized view and it is on buffering mode 5.

Soory, I didn't see that you mean view.
Edward Pikman
Independent Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform