date issue

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

date issue

Post by times29 »

Hi,
I am trying to convert varchar(8) to date and also doing DateOffsetByDays below is syntax but transformer not liking DateOffsetByDays

Thanks

IF IsValid("date", DateOffsetByDays(to_trans4.S_AAA, "%yyyy%mm%dd",1))
THEN StringToDate(to_trans4.S_AAA,"%yyyy%mm%dd")
ELSE StringToDate("99990101","%yyyy%mm%dd")
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The DateOffsetByDays() function needs a date input parameter, which wouldn't work if your source column isn't a valid date.

Try

Code: Select all

IF IsValid("date", to_trans4.S_AAA, "%yyyy%mm%dd")
THEN DateOffsetByDays(StringToDate(to_trans4.S_AAA, "%yyyy%mm%dd"),1)
ELSE StringToDate("99990101","%yyyy%mm%dd") 
(I might have a syntax error in there, but you should get the gist of it).
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

Post by times29 »

can you please take premium content out
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

times29 - I will in this case, since it isn't really complex premium content, but your userid shows as a "premium member" here on the forum.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ArndW wrote:your userid shows as a "premium member" here on the forum.
Unfortunately, all this means is that they were Premium at one point - not that they are currently. They've let it expire.

I've asked for this in the past to be changed to show one's current status but I don't think those kind of changes to the existing forum code are possible. :(
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply