Code to Generate PO Numbers
I'm need my purchase orders numbered based on the PO date and then followed up with a dash and a sequential letter. For instance today I'd need them to be: 06112021-A, 06112021-B, 06112021-C, etc. Please help.
2 replies
-
I look forward to seeing some ideas around auto-increment the next letter. I've seen numbers but not letters.
For the other part you will have to take your date field and create three formula fields to transform the milliseconds to useful numbers.
year(datefield)
month(datefield)
day(datefield)
Then another field to concat the other fields together.
-
Here you go...
let a := this;
let b := format(today(), "MMDDYYYY");
let c := "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let d := "";
let e := substr(last(((select Orders where substring(Ref, 0, 8) = b) order by Ref).Ref), 9, 1);
if e = null then
d := "A"
else
d := substr(c, index(c, e) + 1, 1)
end;
a.(Ref := b + "-" + d)Regards
John
Content aside
- 3 yrs agoLast active
- 2Replies
- 234Views