Here’s my very first attempt at LINQ code from scratch (so be gentle…)
I believe the following code in a Set Field Widget should work.
(from x in Db.POHeader where (x.PONum >= 10000 && x.PONum <= 30000) select x.PONum).Max()+1
Obviously only call it if you pass the condition for testing if its the target Plant
EDIT:
It does no error checking to see if a prior PO existed in that range of 10,000 to 20,000. If none exists it will error out.
Also, our Next PO Num in Company Maint is 35,000