Re: Summing fields
This WebDNA talk-list message is from 1997
It keeps the original formatting.
numero = 10817
interpreted = N
texte = >> >I think it was mentioned once that it is possible to calculate a total>> >for a particular field over records in a database. What is the syntax>> >for doing this?>>>> <--starts a total variable at 0>> [FoundItems]>> >> [/FoundItems]>>>> If you view source you will see this generates a lot of HTML comments>>like with the intermediate results. You might also try>>>> [math]total=[FoundItems][field]+[/FoundItems]0[/math]>>>> This generates a single math equation that looks like total=5+9+4+49+7+96+0>Apparently both methods work cause I see the 's. The second>displayed the total as I wanted. How would I get the total to display>using the first method?If you remove the that surround the [math] context, it willdisplay all those intermediate totals. But if you want to display the grandtotal instead of the intermediate totals, you have to use the secondformula, or ...I created some WebDNA code using a separate database to calculate the totaljust once per day. This allows me to retrieve the total from the databaseinstead of recalculating it every time. If you want my code, just send meprivate email and ask ... :)Sincerely,Ken
Associated Messages, from the most recent to the oldest:
>> >I think it was mentioned once that it is possible to calculate a total>> >for a particular field over records in a database. What is the syntax>> >for doing this?>>>> [math]total=0[/math]> <--starts a total variable at 0>>
[founditems]>> [math]total=total+[field][/math]>>> [/FoundItems]>>>> If you view source you will see this generates a lot of HTML comments>>like with the intermediate results. You might also try>>>>
[math]total=
[founditems][field]+[/FoundItems]0[/math]>>>> This generates a single math equation that looks like total=5+9+4+49+7+96+0>Apparently both methods work cause I see the 's. The second>displayed the total as I wanted. How would I get the total to display>using the first method?If you remove the that surround the
[math] context, it willdisplay all those intermediate totals. But if you want to display the grandtotal instead of the intermediate totals, you have to use the secondformula, or ...I created some WebDNA code using a separate database to calculate the totaljust once per day. This allows me to retrieve the total from the databaseinstead of recalculating it every time. If you want my code, just send meprivate email and ask ... :)Sincerely,Ken
Kenneth Grome
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
WebCatalog2 Feature Feedback (1996)
Cyberstudio and WebDNA (1997)
Summary search -- speed (1997)
Quickie question on the email templates (1997)
Off-Topic: Optimal WebSTAR settings for WebDNA plugin v4.5 (2002)
WC2f3 (1997)
Problems with ^ could be solved with [REPLACE CHARACTERS] (1997)
Multi-processor Mac info ... (1997)
[WebDNA] JSONStore Levels (2020)
Help--WebCat setup (2000)
DON'T use old cart file! (1997)
Cart doesn't interpret tag! (1997)
OT: 128 bit Encryption (2003)
urls (2005)
WebDNA 5 - Privacy Issue (Built in sniffer) (2003)
bug urgent, [protect admin ] and .max work wrong (2003)
CSS and SSI books (2004)
Help!!!! (1997)
Formulas.db + Users.db (1997)
Stop the madness. (1997)