EDIT: I solved this by changing
But I still feel something must be wrong given that the data returned by each program is in such a radically different format.
I am feeling a little gun shy about posting so many of my posts lately seem to have been stupid mistakes on my part or a lack of understanding .. BUT here we go again.
I am using DBRequestManager.bas
I am running the exact same code in A/J/i
The relevant code:
The problem is this: in B4i the fields are returned in a different order plus size gets added as a bonus field. The data does not. So when my little routine to put stuff in a map is done everything is in the wrong field in B4i. DBResultToMap is meant to be generic so regardless of the data passed it should return a map with everything in the right fields.
DBResultToMap:
res looks completely different in B4i compared toB4j (and I am assuming B4A, I didn't check B4A but it works)
What silly mistake am I making this time? Or do I need to handle B4i data differently?
Thanks in advance for your help.
ColNames(X) = Col
to ColNames(Res.Columns.Get(Col)) = Col
.But I still feel something must be wrong given that the data returned by each program is in such a radically different format.
I am feeling a little gun shy about posting so many of my posts lately seem to have been stupid mistakes on my part or a lack of understanding .. BUT here we go again.
I am using DBRequestManager.bas
I am running the exact same code in A/J/i
The relevant code:
B4X:
'SELECT Emp_Num, Emp_FirstName, Emp_LastName, Emp_AllowEdits, Emp_Rate, Emp_AllowMulti FROM Employees WHERE (Emp_Inactive=0);
Dim req As DBRequestManager = CreateRequest
Dim cmd1 As DBCommand = CreateCommand("GetEmployees", Null)
Wait For (req.ExecuteQuery(cmd1, 0, "GetEmployees")) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
If res.Rows.Size > 0 Then
EMPs = req.DBResultToMap(res)
Else
.
.
Sub DBResultToMap(Res As DBResult) As List
Dim ColNames(Res.Columns.Size) As String, X As Int
For Each Col In Res.Columns.Keys
ColNames(X) = Col
X = X + 1
Next
Dim Rows As List, X As Int, Y As Int
Rows.Initialize
For Each Row() As Object In Res.Rows
X = 0
Dim Cols As Map
Cols.Initialize
Y = 0
For Each Fld As String In Row
Cols.Put(ColNames(Y), Fld)
Y = Y + 1
Next
Rows.Add(Cols)
Next
Return Rows
End Sub
DBResultToMap:
res looks completely different in B4i compared toB4j (and I am assuming B4A, I didn't check B4A but it works)
What silly mistake am I making this time? Or do I need to handle B4i data differently?
Thanks in advance for your help.