Page 1 of 1

Date type cast

Posted: Mon Sep 18, 2006 4:20 am
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

Posted: Mon Sep 18, 2006 7:47 am
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.

Posted: Mon Sep 18, 2006 8:02 am
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??

Posted: Mon Sep 18, 2006 5:39 pm
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().

Posted: Tue Sep 19, 2006 7:15 am
by ahmedwaseem2000
It is still not working when i try to convert to julian still it is giving error

Posted: Tue Sep 19, 2006 6:29 pm
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.

Posted: Tue Sep 19, 2006 9:34 pm
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)

Posted: Tue Sep 19, 2006 10:38 pm
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.

Posted: Wed Sep 20, 2006 10:37 am
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

Posted: Wed Sep 20, 2006 1:49 pm
by rwierdsm
Actually, it's weirdo not wierdo. :wink:

Rob Wierdsma

Posted: Wed Sep 20, 2006 11:25 pm
by ahmedwaseem2000
you see i was out of my mind, then why do you expect me to spell it correctly :wink:

Posted: Fri Mar 11, 2016 11:32 am
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.

Posted: Fri Mar 11, 2016 3:10 pm
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".