carsten.frentz Member Licensed User Longtime User Feb 23, 2013 #1 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" Code: Copy 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
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" Code: Copy 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
E edgar_ortiz Active Member Licensed User Longtime User Feb 23, 2013 #2 You can try: Cursor = SQL.ExecQuery("SELECT ID, COL1, COL2, COL3, COL1+COL2 AS NEWCOL1, 0 AS NEWCOL2 FROM qutab") Regards, Edgar Upvote 0
You can try: Cursor = SQL.ExecQuery("SELECT ID, COL1, COL2, COL3, COL1+COL2 AS NEWCOL1, 0 AS NEWCOL2 FROM qutab") Regards, Edgar
carsten.frentz Member Licensed User Longtime User Feb 23, 2013 #3 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
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