Hello…
On the App event handler (handleUrl)
when the user use the path /check is trigger a method “ModuleData.TriggerCollect”
Var Connection As new MyURLconnection
// 2. Set request headers
Connection.RequestHeader("apikey") = "mykey"
Connection.RequestHeader("Authorization") = "Bearer mykey"
// 3. Send the request asynchronously
Connection.Send("GET", "https://mysite")
On a module.
Property = JsonArray() as auto MyURLconnection and super as URLConnection.
event handler = ContentReceived.
Inside the Contentreceived
Var jsonData As New JSONItem(content)
GetsupabaseData(jsonData)// create the Jsonitem Array
Method GetsupabaseData
For i As Integer = 0 To records.Count - 1
Var record As JSONItem = records.Child(i)
jsonArray.Add (record)
next
MainPage.addrecords(jsonArray)
My problem is when i try to pass the MainPage.addrecords(jsonArray) i get
NilobjectException.
I am sure i miss something but i don’t know what…
debugging do now anything just a error 0 no message or reason…
any help or point will be appreciated
Yes the “NilobjectException” is empty,no informations !!
And everything is public.
And here is the addrecords method.
Using ModuleData
For i As Integer = 0 To records.Count -1
Var record As JSONItem = records(i)
Var theid As string = record.Value("id")
Var objectis As String = record.Value("object")
Var amount As Integer = record.Value("amount")
Var currencyis As String = record.Value("currency")
Var customer As String = record.Value("customer")
Var description As String = record.Value("description")
Var paid As string = record.Value("paid")
Var payment_intent As String = record.Value("payment_intent")
Var receipt_number As String = record.Value("receipt_number")
Var receipt_url As String = record.Value("receipt_url")
Var status As String = record.Value("status")
Var country As String = record.Value("country")
Var message As String = record.Value("message")
Var cardend As String = record.Value("cardend")
Var network As String = record.Value("network")
Var name As String = record.Value("name")
Var email As String = record.Value("email")
Var descripto As String = record.Value("descripto")
Var charged As string = record.Value("charged")
Var created As string = record.Value("created")
Var device As String = record.Value("device")
// get the email for check and find
EmailToFind = record.Value("email")
// Add the row to the ListBox
supalist.AddRow(theid, objectis)//, amount.ToString, currencyis, customer, description, paid, payment_intent, receipt_number, receipt_url, status, country, message, cardend, network, name, email, descripto, charged, created, device)
Next
What i have test until now.
If i remove the MainPage.addrecords(jsonArray) from the Method GetsupabaseData
and put it on Button on the Mainpage and run it is working,but is not what i want.
Click in the NilObjectException at the bottomù right of the screen and read what they say. Sometimes it is helpful. (It give an Error Number and Error Message)
If you mean the variables in method addrecords,there is no Nil there.
Like i say in previous post i f i remove the MainPage.addrecords(jsonArray) from the method and put it on button is working without problem.
the problem is when i call it from the module…
the addrecord variables in 2 post’s above…
Have you stepped through GetsupabaseData with the debugger to see if it is doing what you hope it is doing? When you reach line 11 and get the Nil exception, have you examined jsonArray to see its value?
It seems to me that if records.Count is zero, then jsonArray will be Nil.
There is no Null values on the jsonitem,so the array of jsonitems is ok.
Like i say before, IF i remove the method and run it from a button working and there is no NilObjectException.
So something i do wrong when i try to pass it.
All i want is to populate a weblistbox on the Mainpage with the values of the “JsonArray”.
Thank you.
I get the same results and with webpage.
i am stuck always on the same spot,when i try to pass the data to method and then from this method populate the data on the weblistbox.
i test the project on webpage or in a module the results is the same.
The part that i am confuse is when i remove the addrecords(jsonArray) from a method and put on button then the process is working fine,but i need to be auto triggered to follow the procedure…
The project is like this…
I am using (self hosted) supabase and n8n.
The n8n manipulate the data at 11:00pm and then send the data on supabase,on the same automation after 1 min. send a “GET” to the project to trigger the proccess.
The “GET” trigger the proccess on the xojo project to make the rest like “invoices” etc…
URLConnection events occur outside a session context. A session context tells the framework which MainPage is supposed to be the one receiving the data. Retain the session id in your URLConnection subclass and create a new context before accessing any pages.
i read the websession,session etc… but have nothing to do with my problem…
Supposed to be server side call and when a user login see the MainPage THE ONLY ONE with the weblistbox.
i am no expert on web apps on xojo is my first time,i have about 3 days now i try to figure out how is working and what need to do.
I don’t want to say anything about the documentation again i say it before 4-5 years and is still the same…