Date type cast

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
ahmedwaseem2000
Premium Member
Premium Member
Posts: 145
Joined: Fri Sep 15, 2006 12:23 pm

Date type cast

Post by ahmedwaseem2000 »

Hi ,

I am very very new to DS. I am trying to find max of a date column and a time column. when i tried to find the max date using aggregator transformation. i get the below mentioned error.
Error when checking operator: When binding input interface field "XXX" to field "XXX": No default type conversion from type "time" to type "dfloat".
Error when checking operator: When binding input interface field "YYY" to field "YYY": No default type conversion from type "date" to type "dfloat".
Well, after my further analysis i could find that there is no direct type cast between Date and dfloat. so, the i could figure out 2 ways to achieve my goal.

1st: to convert the date to dayssincedate, when i try to do that i get the below error. However, to achive this conversion i am not able find the function. could any one out there help me pleaseeee???

APT_CombinedOperatorController,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "CCYY-MM-DD" for conversion "int32=days_since_from_date[**********](date)": APT_Conversion_DaysSince_Date: Invalid Date [CCYY-MM-DD] used for days_since_from_date type conversion.
2nd way is to convert the date field to integer and from integer to float.

to achieve both the solutions i need to figure out the function that i can use in a transformer(or any other stage) to type cast.

Thanks in advance to let me know the solution for this, Also, if there exists any other easier way to fix this issue please let me know.

Thanks again,
Waseem
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Check the date format that you have entred. "CCYY-MM-DD"
Instead you can convert to julian date, which also gives you integer as output.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ahmedwaseem2000
Premium Member
Premium Member
Posts: 145
Joined: Fri Sep 15, 2006 12:23 pm

Post by ahmedwaseem2000 »

Kumar thanks for the reply......However, i tried with CCYY after trying out all other possibilities of date format.

Nevertheless, I would try defining the date column as julian and try. could you please let me know what is the purpose of julian date format??
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

It is another similar function as what you tired. Julian data is represented in integer format. It has its own reference date. And the number of days been calculated since that reference data till the given date.
The functions available to convert to integer - JulianDayFromDate(). Do the aggregation function. Then DateFromJulianDay().
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ahmedwaseem2000
Premium Member
Premium Member
Posts: 145
Joined: Fri Sep 15, 2006 12:23 pm

Post by ahmedwaseem2000 »

It is still not working when i try to convert to julian still it is giving error
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

What error?
Basically, Aggregator handles dfloat. If you get the integer value, you should be able to find the way to use aggregator.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ahmedwaseem2000
Premium Member
Premium Member
Posts: 145
Joined: Fri Sep 15, 2006 12:23 pm

Post by ahmedwaseem2000 »

i have tried different type cast like the julian date, date to days, time to seconds nothing seems to be working.

here is the sample of the data.

"19"|"45"|"a"|"b"|"c"|"d"|"e"|"f"|"2006-01-12"|"08:10:50"|
"19"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2006-01-15"|"09:10:50"|
"12"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2006-01-12"|"09:10:50"|
"12"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2006-01-12"|"08:10:50"|

another question here, is it allowed to have date within double quotes??(I have tried even without double quotes)
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

What are you expecting? What is not happening? what is the error you getting?
You will see the Double quotes only at the output/input file. If the quote character is given properly, you dont need to worry about it.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ahmedwaseem2000
Premium Member
Premium Member
Posts: 145
Joined: Fri Sep 15, 2006 12:23 pm

Post by ahmedwaseem2000 »

Wierdo Wierdo Wierdo, i posted previous 2 messages without performing the jobs properly. anyways, i am able to convert the date to julian one - THANKS FOR YOUR HELP KUMAR
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Post by rwierdsm »

Actually, it's weirdo not wierdo. :wink:

Rob Wierdsma
Rob Wierdsma
Toronto, Canada
bartonbishop.com
ahmedwaseem2000
Premium Member
Premium Member
Posts: 145
Joined: Fri Sep 15, 2006 12:23 pm

Post by ahmedwaseem2000 »

you see i was out of my mind, then why do you expect me to spell it correctly :wink:
TonyInFrance
Premium Member
Premium Member
Posts: 288
Joined: Tue May 27, 2008 3:42 am
Location: Luxembourg

Post by TonyInFrance »

Old topic (I know) but I had to go through this (and other similar ones) since I was looking for a solution.

On a hunch I tried the option Preserve type = True within the Aggregator itself....worked fine...:-) No more warnings / aborts.

Basically what happens I guess is on choosing to preserve the datatype the output of the aggregator remains in its source format.
Tony
BI Consultant - Datastage
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

ahmedwaseem2000 wrote:you see i was out of my mind, then why do you expect me to spell it correctly :wink:
Because Rob's family name is spelled "the other way".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply