NetTalk Central

Author Topic: Browse Total will reset if got few pages, any new solutions?  (Read 4913 times)

skyong38

  • Newbie
  • *
  • Posts: 34
    • View Profile
    • Email
Browse Total will reset if got few pages, any new solutions?
« on: April 04, 2019, 11:42:14 PM »
Hi,

I embeded the following code at Set Queue Record :-
        CASE T:DrCr
        OF 'D'
            LocDrAmt = T:Amount
            LocBalance += T:Amount
        OF 'C'
            LocCrAmt = T:Amount
            LocBalance -= T:Amount
        END
The LocBalance will reset every new page.

I search thru previous post on June 25, 2012, it can be solved by using File Load, but it will be very slow when records huge.

Just wonder, any new solution for this after so many years?

Thank you.

Regards,
Nelson

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: Browse Total will reset if got few pages, any new solutions?
« Reply #1 on: April 05, 2019, 12:52:45 AM »
Hallo Nelson,

Just an idea, did you try to play with sessions?

CASE T:DrCr
        OF 'D'
            LocDrAmt = T:Amount
            LocBalance += T:Amount
            p_web.SSV('sv-LocBalance',LocBalance + p_web.GSV('sv-LocBalance'))
            LocBalance = p_web.GSV('sv-LocBalance')
        OF 'C'
            LocCrAmt = T:Amount
            LocBalance -= T:Amount
            p_web.SSV('sv-LocBalance',p_web.GSV('sv-LocBalance') - LocBalance)
            LocBalance = p_web.GSV('sv-LocBalance')
END

You need to reset the session variable when you open the form/browse.
I did not test but maybe will work/help you.

Robert

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Browse Total will reset if got few pages, any new solutions?
« Reply #2 on: April 08, 2019, 02:09:30 AM »
Hello Nelson,

What backend are you using? If SQL you could make a custom SQL statement to get the total.
If TPS you have to read all the records to calc the total, which as you noted could be slow.

cheers
Bruce


skyong38

  • Newbie
  • *
  • Posts: 34
    • View Profile
    • Email
Re: Browse Total will reset if got few pages, any new solutions?
« Reply #3 on: April 08, 2019, 06:08:46 PM »
Hi Robert,
 
Thanks for advice. Tried, doesn't works.


Hi Bruce,

I am using SQL, I will try on method you suggested.

Thank you.

Nelson

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Browse Total will reset if got few pages, any new solutions?
« Reply #4 on: April 09, 2019, 04:45:31 AM »
Hello Nelson,

I'm also working with totals.  I'm doing some work with running balances as well.

The only thing I have found so far that consistently works, with decent speed, is using Views with very focused filters and keys.

I create my own local procedures, call the procedure, and get a return value.

I can honestly say, and you'll probably agree, totals and running balances are a pain the....well you know.  ;D

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11