NetTalk Central

Author Topic: Totals only on last page of browse?  (Read 2911 times)

jking

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Totals only on last page of browse?
« on: November 26, 2018, 06:51:49 PM »
Bruce,

     After searching this forum, I experimented with custom totals and the loc:DisableNext variable as a condition to see if I could get just a final (grand) total on the last page of the browse.  I still got a 0 (zero) value on each page and a total on the last page, but this last page total was still just for the default last 10 rows on the last page.
     Ideally, I want to display 10 rows on each page, with a "partial running" total  but then a final total on the last page, under the "partial running" total.  Or a simpler, a "Final Total" just on the last page.   Is there a better/newer way to accomplish this?
     I thought about keeping a local variable with the total and then just inserting this as HTML right after the browse.  I could not find an embed that I thought would do this, like a "browse footer" embed.  Do you have any suggestions?

Thanks,

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Totals only on last page of browse?
« Reply #1 on: November 27, 2018, 10:53:19 PM »
Hi Jeff,

It's tricky because calculating examples can be "expensive" in terms of time.
Currently the totaling is designed to be "total this page". That's fast and has no impact on performance. If you want more than that you can do it, but obviously you will want to balance speed with usefulness.

>> I experimented with custom totals

This is indeed the way you should go. Usually I create a simple source procedure to calculate the value I want.

>>  Ideally, I want to display 10 rows on each page, with a "partial running" total  but then a final total on the last page, under the "partial running" total.

I think a partial running total would be difficult (or expensive) to calculate. What if the user goes next, next, previous, next, previous, last? you can't simply keep adding pages to the running total. What if they just click on "last"?

I'd drop the idea of a running total, and just focus on the grand total. You can calculate this the first time the browse opens (tie to the filter and session - if the filter changes you need to re-calc the total). Then set the custom total to this value.

I can go through this with you in a user group webinar if you like. (Of course calculating the total may take a few seconds when the browse opens, depending on the size of the data being totaled.)

Cheers
Bruce