Hi all, I am frustrated and desperate. I have spent nearly my entire day trying to do one simple thing with no luck.
I am trying to remove plants from a user ala UserComp. You cannot save a UserComp with an empty plantlist - makes sense to me.
I have tried umpteen different flavors of UserFile.Update() to delete this record. In most cases, I get no errors, but also the record is not deleted. I have tried with and without a before image record.
//thisUserComp rec is my current record
uf.AddUserCompany(user, ref ufts);
var newRec = ufts.UserComp.First(f => f.RowMod == "A");
BufferCopy.Copy(thisUserCompRec, newRec);
//new row will delete
newRec.RowMod = "D";
uf.Update(ref ufts);
No errors, no action.
Strangely tracing isnt helpful, even with a full trace and responses it shows me only the RESULT (not the data going into the call).
Even UpdateExt says things are good, the rogue record still in the Db begs to differ.
@Chris_Conn It looks like you can only change the plant list in UserComp or if you want to delete you have to go up to UserFile and delete that record which also deletes UserComp
Ever since moving to E11 I have been having similar issues trying to delete things even on UD tables.
Found a nice snippet from Jose at one point, don’t remember the post or I’d tag it. This is what I got working though using a SvcContract, seems to be about the only reliable one I’ve been using lately.
Ice.Contracts.UD01SvcContract UD01Svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD01SvcContract>(Db);
var list = Db.UD01.Where(I => I.Key1 == "YourFilter").ToList();
if (list != null && list.Count > 0)
foreach (var row in list)
{
UD01Tableset tableset = UD01Svc.GetByID(row.Key1, row.Key2, row.Key3, row.Key4, row.Key5);
tableset.UD01[0].RowMod = "D";
UD01Svc.Update(ref tableset);
}
Maybe a similar approach will work - letting the Db context close the table so it’s free to update again (or at least my guess as to what’s happening).