Page 1 of 1

Finding Max of date

Posted: Mon Aug 01, 2005 11:30 pm
by kumar_s
Hi,
Is there any issue to find maximum of date.
mine is simple flow. input has data with date type feild. i just need find the max of the date based up on a grouping col. Iam getting the follwing error

Code: Select all

Aggregator_1: Error when checking operator: When binding input interface field "doj" to field "doj": No default type conversion from type "date" to type "dfloat"
Here "doj" id the name of the date field. it seems it is implictly converting from date to dfloat. i just grouped based on a column and found Maximum Value Output Column of this "doj" and nothing else. Output is also in date format.

Should i have to do anything more than this for date type or it happens for all?!?!?!?.......

regards
kumar

Posted: Tue Aug 02, 2005 6:32 am
by Kirtikumar
I just tried this getting similar error :(

From the error, it looks like internally DS aggr stage converts the columns to Dfloat before doing any Max/Min/Sum.

I tried adding to modify stage to convert Date to Int or float, but this is not permitted in modify stage.

One more try: converting the Date to integer using IConv of basic transformer and then doing min max :idea:

let see!!!

Posted: Tue Aug 02, 2005 7:33 am
by roy
Hi,
Try using a character oriented data type.
worst case scenario convert the date to numeric format of yyyymmdd

Posted: Tue Aug 02, 2005 8:00 am
by kumar_s
Hi,
yes we tried every thing else, Iconv and Oconv works.
But we faced sluggish response of server due to Basic Transformer usage. Resulted in restrating server :cry:
Tried with StringToDecimal and then back to date. But unfortunately i faced a error which carries a native datatype of decimal all along to way.
We also had a thread reg this issue in this forum.
Atlast Tring with varchar oriented conversion, mmmm... WORKING. Feeling bad to carry two transformer on both side of Aggregator :cry:

regards
kumar

Posted: Tue Aug 02, 2005 11:24 am
by kumar_s
hi,

when i tried with char or varchar oriented method, i faced an issue which return only the year part.
But the way in which senthil proceeded, no probs........
works good :lol:

regards
deepak

Finding Max of date

Posted: Wed Aug 03, 2005 12:49 am
by tusharzade
Hi,

One approach is to Convert your date in the Integer format means if yor date is "yyyy-mm-dd" then convert it into "yyyymmdd" which is the integer and then use the max/min function. You can not aggregate on Date column as Aggregator stage converts into default dfloat before doing any aggregation.

Regards,
Tushar

Re: Finding Max of date

Posted: Fri Aug 05, 2005 1:37 pm
by kumar_s
Hi,
may i know how to convert to integer, is it through datetostring..... or any methond available.........

regards
kumar
Hi,

One approach is to Convert your date in the Integer format means if yor date is "yyyy-mm-dd" then convert it into "yyyymmdd" which is the integer and then use the max/min function. You can not aggregate on Date column as Aggregator stage converts into default dfloat before doing any aggregation.

Regards,
Tushar

Posted: Fri Aug 05, 2005 6:57 pm
by ray.wurlod
Once you've removed the delimiter characters from the string, you can use the AsInteger() function.

Posted: Sat Aug 06, 2005 12:44 am
by kumar_s
Hi,
I felt string in such case can e implicitly converted to integer, am i right :roll:

regards
kumar

Posted: Sat Aug 06, 2005 7:15 pm
by ray.wurlod
Not in parallel jobs. That's why the AsInteger() function exists.

Posted: Sat Aug 06, 2005 8:47 pm
by chulett
I don't think anything implicitly converts in parallel jobs. :wink:

Posted: Sun Aug 07, 2005 1:50 am
by ray.wurlod
Things that are "promotable", for example int8 to int16 or int32, can convert implicitly in parallel jobs. Otherwise the conversion must be performed explicitly. There is a table explaining this in the Parallel Job Developer's Guide, from memory in the chapter on the Modify stage.