possible to add a addtional column to a cursor ?

cfrentz

Member
Licensed User
Longtime User
so far my first steps in b4a works fine ...
my question regarding SQL lib, is it possible to add a new column to a cursor (which does not come from db table) ?

my intention is to scroll over the cursor elements and compute a value based on col1, col2 and col3 of each "record"
the calculated value i want to "save" with the cursor "record"
B4X:
Dim Cursor As Cursor
Cursor = SQL.ExecQuery("SELECT ID, COL1, COL2, COL3 FROM qutab")
For i = 0 To Cursor.RowCount - 1
   Cursor.Position = i
   Log(Cursor.GetString("COL1"))
Next
Cursor.Close
 

edgar_ortiz

Active Member
Licensed User
Longtime User
You can try:

Cursor = SQL.ExecQuery("SELECT ID, COL1, COL2, COL3, COL1+COL2 AS NEWCOL1, 0 AS NEWCOL2 FROM qutab")

Regards,

Edgar
 
Upvote 0

cfrentz

Member
Licensed User
Longtime User
thxs edgar,
but unfortunately this does not help my
reson is that calculation is based on previous , current and next record
so hard to code in a sql statement :)

meanwhile found a way by copying cursor to a list of arrays

again thxs 4 quick response
 
Upvote 0
Top