Ola
This is my definition of my SHARED...
My initialize call is like this..
The intention is to pass the initialize sub a payload which will be converted to a map only if its available.
The SERVER call for this works exceptionally well and I don't have issues as I am able to pass it a payload, it processes it without issues. This is made via a promise call to this method
This receives a payload, converts it into a map and assign values to the SHARED variables as defined in CLASS GLOBALS above.
The problem starts when calling SHARED Initialize from the BROWSER, I'm getting a cannot set property 'length' of null.
This error happens during this call, its like the variables and their types no longer exist. Perhaps I'm doing this the wrong way.
Thanks.
This is my definition of my SHARED...
B4X:
#Region BANano
' <-------------- IMPORTANT! This is because we want the non specific B4J code in this module to be transpiled by BANano
#End Region
Sub Class_Globals
Private BANano As BANano 'ignore
Public OK As Boolean
Public DBase As String
Public result As List
Public command As String
Public types As List
Public args As List
Public query As String
Public response As String
Public error As String
Public affectedRows As Long
Public payload As String
Private usePool As Boolean
Public lastID As Long
Public view As String
Public action As String
#if b4j
Private jSQL As SQL
Private pool As ConnectionPool
#end if
End Sub
My initialize call is like this..
B4X:
Sub Initialize(pl As String)
Log("SHAREDDoc.Initialize")
'Try
result.Initialize
command = ""
DBase = ""
types.Initialize
args.Initialize
types = Null
args = Null
query = ""
response = ""
error = ""
affectedRows = 0
payload = ""
OK = False
usePool = False
lastID = 0
view = ""
action = ""
'Catch
' Log(LastException)
'End Try
If pl <> "" Then
payload = pl
FromJSON(payload)
End If
End Sub
The intention is to pass the initialize sub a payload which will be converted to a map only if its available.
The SERVER call for this works exceptionally well and I don't have issues as I am able to pass it a payload, it processes it without issues. This is made via a promise call to this method
B4X:
Sub SQLOnServer(payload As String) As String
Log("ServerIndex.SQLOnServer...")
odbc.Initialize(payload)
odbc.OpenSQL
odbc.ToJSON
odbc.CloseSQL
Return odbc.payload
End Sub
This receives a payload, converts it into a map and assign values to the SHARED variables as defined in CLASS GLOBALS above.
The problem starts when calling SHARED Initialize from the BROWSER, I'm getting a cannot set property 'length' of null.
This error happens during this call, its like the variables and their types no longer exist. Perhaps I'm doing this the wrong way.
B4X:
Dim resp As String
Dim prom As BANanoPromise = ws.RunFunctionWithResult("SQLOnServer", Array(jsonPayload))
BANano.Await(prom)
prom.Then(resp)
Log("payload received...")
Log(resp)
odbc.Initialize(resp)
Log(odbc)
Thanks.