2 Replies Latest reply on Mar 8, 2017 12:28 AM by Johan Hedman

# Need help with add preceeding numbers to field

Hi,

I have a calc field that gives the last 2 digits of the year and a reference number. i.e.  17-1, 17-15, 17-100

I need to make the reference number part always be 3 digits. 17-001, 17-015, 17-100

this is my current calc

Case(Right( Year(Get(CurrentDate));2) = Left(IncidNFD;2); Right( Year(Get(CurrentDate));2)  &  "-"  & ( Middle(IncidNFD;4;12)+1); Right( Year(Get(CurrentDate));2)  &  "-"  & "1")

How can I do this? Can't seem to figure this out.

marc

• ###### 1. Re: Need help with add preceeding numbers to field

Making 3 digits is something like

Let ( y = Right ( Year ( Get ( CurrentDate ) ) ; 2 ) ;

SerialIncrement ( y & "-001" ;

Case ( y = Left ( IncidNFD ; 2 ) ; Right ( IncidNFD ; 3 ) )

) //SerialIncrement

) //Let

But, isn't this field itself IncidNFD?? I guess you need to refer "last value in the same year".

• ###### 2. Re: Need help with add preceeding numbers to field

I use the Right function for this

Then my calculation would be

17 & Right ( "000" & ReferenceNumber ; 3 )