Page 1 of 1

Date-1

Posted: Thu Oct 12, 2006 12:02 am
by khaja.arshad
Hello all

Im trying to get the previous date from the below derivation

StringToDate(trim(DSLink6.end_serv_date),"%dd-%mmm-%yy")-1

here link DSLink6.end_serv_date is a varchar type

while im trying above im getting the compilation error as


Error in output column derivation expression for column End_Serv_Date in link DSLink7. Invalid conversion requested from a date to a dfloat.

can any one help me out

Thanks in Advance

Posted: Thu Oct 12, 2006 1:07 am
by ArndW
You have successfully converted your string to a date, but that datatype doesn't allow numerical math to be performed on it, so DS tries to convert the date to a dfloat and fails (because no implicit conversion rules are defined). You need to use one of the date conversion functions such as DateFromDaysSince() .

Posted: Thu Oct 12, 2006 1:21 am
by khaja.arshad
Hello AndrW

im unable to see your reply completely

can you please share me your knowledge for this time

Thanks

Posted: Thu Oct 12, 2006 1:39 am
by ArndW
The short form is to use the DateFromDaysSince() function.

Posted: Sun Oct 15, 2006 3:46 am
by khaja.arshad
Hello Andrw

Iam getting the date value in Varchar format

i have converted it in to Date format YYYY-MM-DD Using string_to_date function i have put it in to staging varaible the Field name is DT

in Transformer im Using
DateFromDaysSince(%number%,[%"yyyy-mm-dd"%])

im Substituting the the values like DateFromDaysSince(2, DT)

In Run time it is giving error as follows

APT_CombinedOperatorController,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "**********" for conversion "date=date_from_days_since[**********](int32)": APT_Conversion_Date_DaysSince: Invalid Date [**********] used for date_from_days_since type conversion.
Operator signalled one or more errors.


Can you tell me where im going wrong

Thanks in Advance

Posted: Sun Oct 15, 2006 4:50 am
by ArndW
Try putting your stage variable into an output link to a peek stage. You will see that you most likely did not convert your date correctly.

Re: Date-1

Posted: Thu Dec 27, 2007 10:22 pm
by niranjansigeni
Hi

It may be a late reply, but i am posting you the answer. May be helpful for someone later on..

try this

DateFromJulianDay(JulianDayFromDate(your_date)-1)

Thanks










khaja.arshad wrote:Hello all

Im trying to get the previous date from the below derivation

StringToDate(trim(DSLink6.end_serv_date),"%dd-%mmm-%yy")-1

here link DSLink6.end_serv_date is a varchar type

while im trying above im getting the compilation error as


Error in output column derivation expression for column End_Serv_Date in link DSLink7. Invalid conversion requested from a date to a dfloat.

can any one help me out

Thanks in Advance

Re: Date-1

Posted: Thu Dec 27, 2007 10:24 pm
by niranjansigeni
Hi

It may be a late reply, but i am posting you the answer. May be helpful for someone later on..

try this

DateFromJulianDay(JulianDayFromDate(your_date)-1)

Thanks










khaja.arshad wrote:Hello all

Im trying to get the previous date from the below derivation

StringToDate(trim(DSLink6.end_serv_date),"%dd-%mmm-%yy")-1

here link DSLink6.end_serv_date is a varchar type

while im trying above im getting the compilation error as


Error in output column derivation expression for column End_Serv_Date in link DSLink7. Invalid conversion requested from a date to a dfloat.

can any one help me out

Thanks in Advance

Posted: Fri Dec 28, 2007 12:45 am
by naveen19
Hi,

any way i am just hadding little bit flavour to niranjansigeni post

create stage variables
1.In that stage variables properties change the datatype as date
2.And the output column should be the date


StringToDate(IP.ED_DATE,"%yyyy-%mm-%dd")-- sv

piont sv to output column

in that Derivation apply

DateFromJulianDay(JulianDayFromDate(sv)-1)

as guided by niranjansigeni

U will get the output perfect..


Regards
Naveen.K