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:
won't serve .tpl -permissions (2000)
Pithy questions on webcommerce & siteedit (1997)
unable to launch acgi in WebCat (1997)
dos command not working the same as does at prompt? (1998)
For those of you not on the WebCatalog Beta... (1997)
[WebDNA] Simple Date Format Conversion (2008)
emailer setup (1997)
docs for WebCatalog2 (1997)
re: Large databases in WebCat (1997)
Accented chars and emailer (1998)
search results (1998)
unable to launch acgi in WebCat (1997)
Configuring E-mail (1997)
[group] ? (1997)
File Upload (1997)
searching multiple databases in single search (1997)
Using Webcatalog to write a search engine.... (2001)
Newbie problem blah blah blah (1997)
HELP WITH DATES (1997)
minimalist shopping cart. (1997)