Store sqlite sum result in variable

Hi,
I would like to store the results of this statement in a variable if that’s possible.
I could not find any reference in xojo or in the sqlite documentation online. Any help would be greatly appreciated.

Thanks!

Sum(RT_Amount) from RegisterTrans Where RT_Category = ‘sometext’

You’ll have to connect to your sqlite database first. I assume it’s got a table called RegisterTrans which has a column called RT_Category?

Then you need to issue a SELECT statement against the database to ask for the data, which will go into a RowSet. Then you get that result data out of the RowSet and into your variable.

Your select is going to look like:

select Sum(RT_Amount) from RegisterTrans Where RT_Category = ‘sometext’

Have you verified that SQLite has a Sum fuunction that does swhat you appear to want?

Look up SqliteDatabase, RowSet, Connect in the XOJO docs, first off.

Hi Tim. Thanks for responding.
If I’m understanding correctly, I run the executeSql sum statement and then a select statement against the database to get the value. I’m still not clear where the Sum value is stored? The statement works perfectly running it in my datebase browser and in my code. Just not sure how to reference the total. Trying to understand. Thanks for your patience …

Hi again,
Figured out what you meant. It’s working nicely.

Thanks so much!