Ordering text

Terence Heaford theaford at btinternet.com
Wed Apr 1 15:13:00 EDT 2020

This actually works but is very slow (> 800ms)

put merge("SELECT *,SUM (amount) OVER (ORDER BY recID) AS balance FROM myAccountName") into tSQL

I have settled on my earlier suggestion

Earlier suggestion results in 20ms performance.

I believe it’s sorted (forgive the pun)

As the data is stored in an SQLite db I have used the db to sum the values then worked from the top. Like below.

This results in approx. 20ms for each sort direction.

I have looked into a running total calc using SQLite but the solutions I found seemed rather complicated.

Sometimes asking for help then presents a solution.




> On 29 Mar 2020, at 22:24, doc hawk via use-livecode <use-livecode at lists.runrev.com> wrote:
> UPDATE theTable SET tBal=tBal(idx -1) + charge WHERE idx > MIN(idx);

More information about the use-livecode mailing list