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("Af"), Item.Get("Estado"), Item.Get("Serie"), Item.Get("Tipo"), Item.Get("Marca"), Item.Get("Modelo"), Item.Get("FechaCompra"), Item.Get("FechaAsignacion"), Item.Get("Asignado"), Item.Get("Sucursal"))) '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 = ?, c5 = ?, c6 = ?, c7 = ?, c8 = ?, c9 = ?, c10 = ? WHERE rowid = ?", params)
B4XTable1.Refresh
End If
End If