Is there a limit to the size of a List?

GlenAlan

Member
Licensed User
Longtime User
When trying to extract the 101st row of a List created from a JSON string, I get the following error:

AccNo= m.Get("AccNo"): java.lang.RuntimeException: Object should first be initialized (Map).

Here is the Code that generates the error ("QueryList" is Dim'd as a List in the Process Globals section of the Main module).

(The Main.QueryList.Size is 182)

For i = 0 To Main.QueryList.Size - 1
Dim m As Map
m = Main.QueryList.Get(i)
AccNo = m.Get("AccNo") '<<< the error happens here when =101
AccName = m.Get("Name")
Balance = NumberFormat2(m.Get("Balance"), 0, 2, 2, True)
Table1.AddRow(Array As String(AccNo, AccName, Balance))
Next
 

JonPM

Well-Known Member
Licensed User
Longtime User
You have to do just what the error message is telling you, initialize the Map.
Map1.Initialize
 
Upvote 0

GlenAlan

Member
Licensed User
Longtime User
Sorry. I should have mentioned that I tried that.

I put an "m.Initialize" after the "Dim m as Map" and it still comes up with the error.

Also, the error only happens after it has successfully retrieved the first 100 rows (with or without the m.Initialize).
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
You shouldn't dim and initialize the map within your for loop, do it before, or even in the globals section
 
Upvote 0

GlenAlan

Member
Licensed User
Longtime User
Ok. Found the problem.

It turns out that, although the web service is returning a JSON string with 180 rows, rows 101 to 180 are NULLS (bug in the web service code).

Although the Nulls are correctly parsed by b4a's JSON parser and placed in the List, the extraction of Null elements from the List to a Map causes this error. Unfortunately, the error explanation mislead me and confused the issue.

Thanks for all the help.
 
Upvote 0
Top