Re: Summing fields
This WebDNA talk-list message is from 1997
It keeps the original formatting.
numero = 10760
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+0I'm not sure if there's a limit to the length of the math expression, but I think it will be OK if it gets long.You might also try keeping some kind of running total (in a separate related database) as people add/delete records in your database. This would entail doing a [replace] each time someone does something to affect your database.Grant Hulbert, V.P. Engineering | ===== Tools for WebWarriors =====Pacific Coast Software | WebCatalog Pro, WebCommerce Solution11770 Bernardo Plaza Court, #462 | SiteEdit Pro, SiteCheck, PhotoMasterSan Diego, CA 92128 | SiteGuard619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com
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+0I'm not sure if there's a limit to the length of the math expression, but I think it will be OK if it gets long.You might also try keeping some kind of running total (in a separate related database) as people add/delete records in your database. This would entail doing a
[replace] each time someone does something to affect your database.Grant Hulbert, V.P. Engineering | ===== Tools for WebWarriors =====Pacific Coast Software | WebCatalog Pro, WebCommerce Solution11770 Bernardo Plaza Court, #462 | SiteEdit Pro, SiteCheck, PhotoMasterSan Diego, CA 92128 | SiteGuard619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com
Grant Hulbert
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:
Funny Submissions From a Form Page (1999)
WCS Newbie question (1997)
listfiles-looking for slick solution (1997)
how to check for no value while using [URL] to prevent cr (1999)
WebCat2 beta 11 - new prefs ... (1997)
2.0Beta Command Ref (can't find this instruction) (1997)
values being mis-placed in results (2000)
PLEASE REMOVE MY EMAIL ADDRESS (1997)
ServerQuestion (2000)
Webstar 4.2 Stops Serving (2000)
WebCat2.0 [format thousands .0f] no go (1997)
Upgrading old WebCat Database Files (1997)
using showpage and showcart commands (1996)
NT beta ReadMe missing (b12-b15) (1997)
I want my files to have an asp file extension (1999)
sendmail what is SIMS? (1999)
I'm new be kind (1997)
Mac Vs WindowsNT (1997)
GrandTotal not right (1997)
Loss in Form (1998)