Re: Running subtotal?

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 18406
interpreted = N
texte = It's also possible to this with only one search and a couple of [math] variables.[Search ....] [math show=f]LastDate=0[/math] [math show=f]RunningSubtotal=0[/math] [FoundItems] [HideIf [index]=1] [ShowIf [date]>[math]LastDate[/math]] Total for date: [math]RunningSubtotal[/math]

[math show=f]RunningSubtotal=0[/math] [/ShowIf] [/HideIf] This hour: [whours]
[math show=f]LastDate=[date][/math] [math show=f]RunningSubtotal=RunningSubtotal+[whours][/math] [/FoundItems] Total for date: [math] RunningSubtotal[/math]

[/Search] This (untested) snip is based on some code that I have used to insert blank lines between months in a listing of events. You'll need to tweak some stuff (like the date comparisions, depending on your date format), but it should do what you need. I'm not sure if there are any advantages to this over Grant's two-search method, but there's always more than one way to skin a cat.-Dave At 8:50 PM 6/19/98, PCS Technical Support wrote: >>Here's one that's way beyond my mortal abilities. I am trying to insert a >>running subtotal into a [foundItems] context that breaks at each date change >>and totals the hours for each date. The search at the bottom is hard-coded to >>return results for 6/12 just as a test. > >To get the date break, you would do a summary sort by date so that only >unique dates are shown, then do a nested search inside that for each date >the outer search finds. > >(untested) >[search db=hours.db&equserdata=[username]&wdatesumm=T&aswdatesort=1] > [FoundItems] > Date: [wdate] > [Search db=hours.db&equserdatarq=[username]&eqwdatedatarq=[wdate]] <-- >this wdate comes from the outer search --> > [math show=f]runningtotal=0[/math] > [founditems][math >show=f]runningtotal=runningtotal+[whours][/math][/founditems] > [math]runningtotal[/math]
> [/Search] > [/FoundItems] >[/search] > >Technical Support | ==== eCommerce and Beyond ==== >Pacific Coast Software | WebCatalog, WebMerchant, >11770 Bernardo Plaza Court | SiteEdit Pro, PhotoMaster, >San Diego, CA 92128 | Typhoon >619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com/ o--------------- Dave MacLeay --+ o----------- Digital Frontier --+ o--- dave@digitalfrontier.com --+ Associated Messages, from the most recent to the oldest:

    
  1. Re: Running subtotal? (Dave MacLeay 1998)
  2. Re: Running subtotal? (PCS Technical Support 1998)
  3. Running subtotal? (Gil Poulsen 1998)
  4. Running subtotal? (Gil Poulsen 1998)
It's also possible to this with only one search and a couple of [math] variables.[Search ....] [math show=f]LastDate=0[/math] [math show=f]RunningSubtotal=0[/math] [founditems] [HideIf [index]=1] [ShowIf [date]>[math]LastDate[/math]] Total for date: [math]RunningSubtotal[/math]

[math show=f]RunningSubtotal=0[/math] [/ShowIf] [/HideIf] This hour: [whours]
[math show=f]LastDate=[date][/math] [math show=f]RunningSubtotal=RunningSubtotal+[whours][/math] [/FoundItems] Total for date: [math] RunningSubtotal[/math]

[/Search] This (untested) snip is based on some code that I have used to insert blank lines between months in a listing of events. You'll need to tweak some stuff (like the date comparisions, depending on your date format), but it should do what you need. I'm not sure if there are any advantages to this over Grant's two-search method, but there's always more than one way to skin a cat.-Dave At 8:50 PM 6/19/98, PCS Technical Support wrote: >>Here's one that's way beyond my mortal abilities. I am trying to insert a >>running subtotal into a [founditems] context that breaks at each date change >>and totals the hours for each date. The search at the bottom is hard-coded to >>return results for 6/12 just as a test. > >To get the date break, you would do a summary sort by date so that only >unique dates are shown, then do a nested search inside that for each date >the outer search finds. > >(untested) >[search db=hours.db&equserdata=[username]&wdatesumm=T&aswdatesort=1] > [founditems] > Date: [wdate] > [Search db=hours.db&equserdatarq=[username]&eqwdatedatarq=[wdate]] <-- >this wdate comes from the outer search --> > [math show=f]runningtotal=0[/math] > [founditems][math >show=f]runningtotal=runningtotal+[whours][/math][/founditems] > [math]runningtotal[/math]
> [/Search] > [/FoundItems] >[/search] > >Technical Support | ==== eCommerce and Beyond ==== >Pacific Coast Software | WebCatalog, WebMerchant, >11770 Bernardo Plaza Court | SiteEdit Pro, PhotoMaster, >San Diego, CA 92128 | Typhoon >619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com/ o--------------- Dave MacLeay --+ o----------- Digital Frontier --+ o--- dave@digitalfrontier.com --+ Dave MacLeay

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:

Incorrect Permission Settings (2003) problems with 2 tags shakur (1997) Separate SSL Server (1997) underscore in variable name (2000) WebCat2b12 Mac.acgi--[searchstring] bug (1997) [SearchString] usage (1997) RE: automatic reload of frameset (1997) Include a big block of text (1997) [OT] 'Email this story to a friend' (2003) Missing Cart Information (2003) Need relative path explanation (1997) 'does not contain' operator needed ... (1997) [WriteFile] problems (1997) THANKS!!! ShipCosts.db and debugging (1997) Realtor Search (2000) sendmail and accented characters (1998) NT Manual (1997) test (2003) Banners (1997) [WriteFile] problems (1997)