Page 1 of 1

Formating issue

Posted: Thu Jul 22, 2004 12:58 am
by badri
Hi,

I have a date formating issue. The below stage validation returns correctly (Else part) if the PeriodNum is in double digit i.e. say 10152004

In the 'Else' part if the LNK1.periodNum is 3 then it should return 03152004 instead of 3152004


IF(LNK1.TRANSACTIONTYPE = '100' ) Then '1215' : (LNK1.Year - 1)
Else
LNK1.PeriodNum : '15' : LNK2.Year

Without going for OConv is there any other logic.

Thanks in Advance
Badri

Posted: Thu Jul 22, 2004 1:23 am
by rasi
Unless you send the input PeriodNum in text format and treat the transformation as text format you can't without in-built function. Can use Oconv or Format function to do this.

Thanks
Siva

Posted: Thu Jul 22, 2004 4:25 am
by mleroux
Just check if it needs a leading zero:

Code: Select all

IF(LNK1.TRANSACTIONTYPE = '100' ) Then '1215' : (LNK1.Year - 1) 
Else 
  If LNK1.PeriodNum < 10 Then
    '0' : LNK1.PeriodNum : '15' : LNK2.Year
  Else
    LNK1.PeriodNum : '15' : LNK2.Year

Posted: Thu Jul 22, 2004 6:30 am
by chulett
As mentioned - format the output:

Code: Select all

IF(LNK1.TRANSACTIONTYPE = '100' ) Then '1215' : (LNK1.Year - 1) 
Else 
    FMT(LNK1.PeriodNum:'15':LNK2.Year,"8'0'R")
Note, the syntax is off the top of my head first thing in the morning, pre-coffee. It should be pretty darn close. :wink: