0

Progressive number from the last one

Hi I am looking for a way to let the invocie number be progressive starting from the last one creted. 
Now I am using this formula: 

if 'Tipo di documento' = 1 then
let y := year(Data);
let c := cnt(select Tabella1 where 'Tipo di documento' = 1);
Testo := "FE" + y + format(c, "000000")
else
if 'Tipo di documento' = 2 then
let y := year(Data);
let c := cnt(select Tabella1 where 'Tipo di documento' = 2);
Testo := "CC" + y + format(c, "000000")
else
null
end
end

The problem is that if i have 30 records and my last number invoce automaticcaly created is FE0030 and then i create a invoce with invocie number FE0035, the next number invoice will be FE0032 but i need invoice number to be like FE0036 . 

I need the invoce number be like  the bigger founded number for the category + 1 

Thank you in advice for help 

1 reply

null

Content aside

  • 3 yrs agoLast active
  • 1Replies
  • 477Views