If RowId > 0 Then 'View the content of the fields
Dim Item As Map = B4XTable1.GetRow(RowId)
Dim components() As String = Regex.Split(" ",Item.Get("Name"))
Item.Put("FirstName", components(0))
Item.Put("LastName", components(1))
End If
Wait For (PrefDialog.ShowDialog(Item, "OK", "CANCEL")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
Dim id As Int
Dim params As List
params.Initialize
If RowId = 0 Or Action >=2 And Action <=3 Then 'add new row
If B4XSwitch1.Value Then B4XSwitch1_ValueChanged(False)
id = B4XTable1.mCurrentCount + 1 'new rowid
Else
id = Item.Get("CustomerId")
End If
' If Item.Get("Company") = "null" Then Item.Put("Company",Null)
' If Item.Get("Address") = "null" Then Item.Put("Address",Null)
params.AddAll(Array(id, Item.Get("FirstName"), Item.Get("LastName"), Item.Get("Company"), Item.Get("Address"), Item.Get("Email"))) 'keys based on the template json file