Updatable BAQ PartSug

Good day to you all,
In our test environment we added some user fields to the PartSug table we wish to update. it seems this is a System Table, and most of the fields show as Read Only.

I’ve created a UBAQ that uses PlanningWB - UpdateExt BO. When I try to update any field I get the following msg:

Severity: Exception, Table: PartSug, Field: , RowID: 708c4136-0cb1-4573-bf6c-f21752baac41, Text: Cannot update Part Suggestions with this object
Query returned 1 row(s).

Any suggestions? Thanks,

Is the PartSug table the best place for these fields?

And don’t PartSug records get deleted and recreated when Generate Suggestions is performed?

1 Like

Hi, I know is an odd request; they need a “reviewed” box to check, as sometimes they won’t act on a suggestion and want to flag them as “reviewed”. Our MRP does not run everyday on every part, so suggestions stay there for a while until MRP runs and recreates the table as you mentioned.

Hi, why don’t you have a review record on the part. When they are reviewing suggestions, are they reviewing all suggestions for that part?

I thought Suggestions already had something like that.

Hi, yes but when you do a regen it goes away. A bit like you suggested above.

If you are updating only UD fields, then you can directly update the table using Advanced BPM Update Only option, Base Processing .

PO Suggestions do have that checkbox, but not Job Suggestions

Hi Arul, I tried this and the error went away. It showed as successfully executed, but it is not saving the changes. I refreshed the Grid and the lines checked were unchecked.

This is how I made the Adv BPM Update:

image

image

Instead of std. options, write C# code and directly update the UD field.

using (System.Transactions.TransactionScope transactionScope = IceDataContext.CreateDefaultTransactionScope())
{
  
    var ttResultQuery = ttResults
        .Where(row => !string.IsNullOrEmpty(row.RowMod) && row.RowMod != "P");

    foreach (var ttResult in ttResultQuery)
    {
        
        
     }   
     this.Db.Validate();
     transactionScope.Complete();
}
2 Likes

Hi Luis,

We have some UD fields on the SugPODtl data and they work well for us, staying put as long as the PO suggestion stays put, and are completely updateable via bpm or update query at will. Since your updates to the Reviewed field seem to be unsupported / dicey in system, I’d go the UD way to ensure it works for future versions as needed.

Nancy

I added the Custom Code as is, but is not updating changes. Was I supposed to add or edit additional code after the foreach statement? Sorry for my rookie questions.

I think I got it working now. Is this the correct way? Thanks!

using (System.Transactions.TransactionScope transactionScope = IceDataContext.CreateDefaultTransactionScope())
{
  
    var ttResultQuery = ttResults
        .Where(row => !string.IsNullOrEmpty(row.RowMod) && row.RowMod != "P");

    foreach (var ttResult in ttResultQuery)
    {
      
     var dsPartSug = (from tt in Db.PartSug where tt.Company == ttResult.PartSug_Company &&
     tt.TargetJobNum == ttResult.PartSug_TargetJobNum &&
     tt.TargetAssemblySeq == ttResult.PartSug_TargetAssemblySeq &&
     tt. TargetMtlSeq == ttResult.PartSug_TargetMtlSeq select tt).FirstOrDefault();
     
     dsPartSug.CheckBox01 = ttResult.PartSug_CheckBox01;
     
     }   
     
     this.Db.Validate();
     transactionScope.Complete();
}

Yes. that’s correct. Modify
if (dsPartSug != null)
{
dsPartSug.CheckBox01 = ttResult.PartSug_CheckBox01;
}

Thank you!!