Hi
I have a piece of code that I want to use to clean out all map values that are null to be empty strings.
As much as the map variable is passed and has values, the following piece of code always crashes where KeyList is assigned to xMap.Keys with a cannot be cast error.
My logs shows the map variable well enough
Can someone please advise? Thanks
I have a piece of code that I want to use to clean out all map values that are null to be empty strings.
As much as the map variable is passed and has values, the following piece of code always crashes where KeyList is assigned to xMap.Keys with a cannot be cast error.
My logs shows the map variable well enough
B4X:
Sub CleanMapNull(xMap As Map)
Private KeysList As List
Private key As String
Private mVal As Object
Private i As Int
Log(xMap)
KeysList.Initialize
KeysList = xMap.Keys
For i= 0 To KeysList.Size - 1
key = KeysList.Get(i)
mVal = xMap.Get(key)
If mVal = "null" Then xMap.Put(key, "")
Next
End Sub
Can someone please advise? Thanks