Leading zero's in a number field
I am trying to format an invoice number field to have leading zero's with the following lines:
format('Invoice #', "0000");
let i := number(max((select Invoices).'Invoice #'));
'Invoice #' := i + 2
Can anyone tell me where I am going wrong?
5 replies
-
I think you have to format the number in the last line:
let i := number(max((select Invoices).'Invoice #'));
'Invoice #' := format(i + 2,"0000")Steven.
-
Thanks Steven,
unfortunately no leading zero's is the result :(
-
Try using lpad() or change the "format mask" so it is 4 digits longer than the number of digits in your Invoice #.
-
Thanks Sean, it turns out you have to have a text field for it to work.
-
On this note, does anyone know how to add a suffix to the number.
I have a number field called Customer ID. In creation, trigger =
let t:=this;
let maxId := max((select 'Customer Data'). 'Customer ID');
t.'Customer ID' := maxId+1But I want the number to display as: GP-001, GP-002 etc., and not just 1, 2, 3 etc.
Thanks in advance
Content aside
- 4 yrs agoLast active
- 5Replies
- 1579Views