Date-1
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 30
- Joined: Mon May 29, 2006 11:19 pm
Date-1
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
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
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() .
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 30
- Joined: Mon May 29, 2006 11:19 pm
The short form is to use the DateFromDaysSince() function.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 30
- Joined: Mon May 29, 2006 11:19 pm
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
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
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.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 7
- Joined: Sat Sep 09, 2006 7:01 pm
- Location: Jersey
Re: Date-1
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
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
-
- Participant
- Posts: 7
- Joined: Sat Sep 09, 2006 7:01 pm
- Location: Jersey
Re: Date-1
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
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
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
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