I have a KeyValueStore that contains custom type
Now I need to add a field and I modify like this
I publish on the store the new app
First time the new app is run, the existing kvs does not have the NewField, so I'm trying to do like this
But it generate a "null" error
Also adding a Try-Catch does not work
Which is the correct way to manage this ?
B4X:
Type LocCfg(Password As String, Confirmed As Boolean, Cdate As Long)
Now I need to add a field and I modify like this
B4X:
Type LocCfg(Password As String, Confirmed As Boolean, Cdate As Long, NewField as int)
I publish on the store the new app
First time the new app is run, the existing kvs does not have the NewField, so I'm trying to do like this
B4X:
Dim par As LocCfg=KvsLocCfg.Get(key1)
if par.NewField=null or par.NewField="" then par.NewField=0
dim x as int=par.NewField
But it generate a "null" error
Also adding a Try-Catch does not work
B4X:
Dim par As LocCfg=KvsLocCfg.Get(key1)
Dim x as int
try
x=par.NewField
catch
x=0
End Try
Which is the correct way to manage this ?