Removing row from BAQ results on Update

Has anyone been able to remove rows from a BAQ results table on update? I’m deleting rows from a UD table, and after the row is deleted, I want to remove the row from the grid. I know I’ve done this before (see link below), although that was on get list. I can debug it on the server, and see the row being removed from memory, but for the life of me, I can’t get it to remove itself from the grid.

This is my code if anyone can see anything that can be done differently. I’ve tried removing both the row being changed, and the unchanged row, but that doesn’t do it.

//foreach (var x in queryResultDataset.Results.Where(z=>!string.IsNullOrEmpty(z.RowMod)))


for(int i=queryResultDataset.Results.Count-1; i>=0;i--)
{
    var x = queryResultDataset.Results[i];
    if (!string.IsNullOrEmpty(x.RowMod))
    {
    using (Ice.Contracts.UD19SvcContract ud19 = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD19SvcContract>(Db))
    {
      if (x.Calculated_Delete == true)
      {
        ud19.DeleteByID(x.UD19_Key1, x.UD19_Key2,x.UD19_Key3,x.UD19_Key4,x.UD19_Key5);
        queryResultDataset.Results.Remove(x);
        
      }
      else if (x.Calculated_NewRecord == true)
          {
            if (string.IsNullOrEmpty(x.UD19_Key1) || string.IsNullOrEmpty(x.UD19_Key2))
                {
                  throw new BLException("A Part Manager and Site is required for a new record");
                }
            Ice.Tablesets.UD19Tableset myUD19 = new Ice.Tablesets.UD19Tableset();
            ud19.GetaNewUD19(ref myUD19);
            
            var myUD19Row = myUD19.UD19.FirstOrDefault();
            myUD19Row.Key1 = x.UD19_Key1;
            myUD19Row.Key2 = x.UD19_Key2;
            myUD19Row.SetUDField("DefaultPlanner_c",x.UD19_DefaultPlanner_c);
            myUD19Row.SetUDField("DefaulteBuyer_c",x.UD19_DefaulteBuyer_c);
            myUD19Row.RowMod = "A";
            ud19.Update(ref myUD19);
            x.Calculated_NewRecord = false;
          }
      else if (x.Calculated_NewRecord == false)
        {
            var myUD19 = ud19.GetByID(x.UD19_Key1, x.UD19_Key2,x.UD19_Key3,x.UD19_Key4,x.UD19_Key5);
            var myUD19Row = myUD19.UD19.FirstOrDefault();
            myUD19Row.SetUDField("DefaultPlanner_c",x.UD19_DefaultPlanner_c);
            myUD19Row.SetUDField("DefaulteBuyer_c",x.UD19_DefaulteBuyer_c);
            myUD19Row.RowMod = "U";
            ud19.Update(ref myUD19);
        }
      }
      }

}


Add a fake calculated checkbox boolean, on your update mark that as “true” and then create a rule in the grid that hides any records (filters) with that boolean checked.

The update call on UBAQ does not assume the record is going to be deleted.

1 Like