Auto-Increment key1 Epicor UD table


Thanks for your help.
Actually this worked:

Post Processing on GetNewUD02 field and this custom code:

foreach (var ttUD02_R in ttUD02)

var ttUD02_Recs = (from ttUD02_Row in Db.UD02 where ttUD02_Row.Company == Session.CompanyID orderby ttUD02_Row.Number01 descending select ttUD02_Row).FirstOrDefault();

if (ttUD02_Recs != null)
ttUD02_R.Number01 = Convert.ToInt32(ttUD02_Recs.Number01+1);
ttUD02_R.Key1 = "G"+ttUD02_R.Number01.ToString();

1 Like
The increment logic looks a bit suspect you may want to use LastOrDefault() to get the row with the highest value. 

But the end result has to be passed back via the ttUD02 table row.  

ttUD02_row.Key1 = myNextNumber;

In your code you are attempting to update the physical table.

Jim Kinneman
Encompass Solutions, Inc