Moving Data from Part to Quote Dtl

Hello everyone. I am new to C# ( moving from E9 to E10) I am having a hard time moving data from my part master to the QuoteDtl Screen, and was looking for a little help. Here is what I have as of now.

foreach (var tempQuoteDtl in ttQuoteDtl.Where(qd => qd.Updated() || qd.Added()))
{
var part = (from p in Db.Part.With(LockHint.UpdLock) where p.Company == tempQuoteDtl.Company && p.PartNum == tempQuoteDtl.PartNum select p).FirstOrDefault();
if(part!=null)
{
tempQuoteDtl.Number01 = Part.UserInteger1;
Db.Validate();
}
}

Thanks,

Hi Rick,
That code should work (though you don’t need the Db.Validate() bit since you are just writing to the tempQuoteDtl or (tt) table. When are you triggering this BPM?
If its Post Processing then it won’t work because you are writing to the TT Table you’d need to do a LookUp of the Actual Db.QuoteDtl record and then update it.
-Jose

This is processing during Pre-Processing. When I had the data conversion form E9 It brought over the field “Number01” is the system having a hard time with this? Here is the Error I am getting.

Error CS1061: ‘Erp.Tablesets.QuoteDtlRow’ does not contain a definition for ‘Number01’ and no extension method ‘Number01’ accepting a first argument of type ‘Erp.Tablesets.QuoteDtlRow’ could be found (are you missing a using directive or an assembly reference?) [Update.Pre.Seq.cs(79,17)]
Error CS0120: An object reference is required for the non-static field, method, or property ‘Erp.Tables.Part.UserInteger1.get’ [Update.Pre.Seq.cs(79,28)]

So custom fields in E10 do not exists in the TTTables so you’ll have to address that field via the extension SetUDField

tempQuoteDtl.SetUDField<decimal>("Number01",Part.UserInteger1);

What about UserInteger1?

Error CS0120: An object reference is required for the non-static field, method, or property ‘Erp.Tables.Part.UserInteger1.get’ [Update.Pre.Seq.cs(79,48)]

Of course I use a lot of these fields, but I feel If I can get one right it will help with the rest.

Thanks,

it’s part not Part C# is case sensitive and your variable is var part… not Part :slight_smile:

1 Like

Thanks for your help. Man this is going to take some time to get used too.

1 Like

the struggle is real! I had to learn it quickly when uplifting from E9. Still learning, learning learning… Toot Jose’s horn by marking his answer as solved :slight_smile:

A little thing, Your “if” statement need to have double equal characters “==”

Hi Bruce,

He is checking != (not equals) so what he has is fine.

Thanks.