Private Sub ShowDialog(Item As Map, RowId As Long)
Dim data As Map = CreateMap("Type": "Canidae", "Name": "ABC")
Wait For (PrefDialog.ShowDialog(data,"OK", "CANCEL")) Complete (Result As Int)
'Wait For (PrefDialog.ShowDialog(Item, "OK", "CANCEL")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
Dim params As List
params.Initialize
params.AddAll(Array(Item.Get("Type"), Item.Get("Name"), Item.Get("Birth Date"), Item.Get("Sex"))) 'keys based on the template json file
If RowId = 0 Then 'new row
B4XTable1.sql1.ExecNonQuery2($"INSERT INTO data VALUES("", ?, ?, ?, ?)"$, params)
B4XTable1.ClearDataView
Else
params.Add(RowId)
'first column is c0. We skip it as this is the "edit" column
B4XTable1.sql1.ExecNonQuery2("UPDATE data SET c1 = ?, c2 = ?, c3 = ?, c4 = ? WHERE rowid = ?", params)
B4XTable1.Refresh
End If
End If
End Sub