Hi All,
I want tp covert a date value to an integer values and want to make a comparison with the currentdate().
Ex: IncomingDate = 2006-05-12
CurrentDate() = 2006-05-17
Requirement is: If IncomingDate = CurrentDate() Then X Else Y
I need to use above derivation on a tarnsaformer stage.
Can anyone helpme out on how to achieve this?
I am working on Enterprise Edition and Iconv and Oconv are not supported in parallel edition.
Date to Integer in parallel edition
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Why do you want to convert to Integer? CurrentDate() returns a Date, and presumably your input column also is of type Date. Have you tried the expression you posted? Obviously the values generated by the expressions X and Y must be of the correct data type for your output column.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Hi,
Thanks for your answer, Actually I am not populating the date column in the target I will be using the Incoming date from a feed file and need to compare it with the currentDate() of the system if both are same then I need to populate a different column based on this condition. Since date columns cannot be compared or rather they need be either a character data or numeric one for comparison. thats the reason I m looking for a conversion to Integer.
Many Thanks,
Spendem
Thanks for your answer, Actually I am not populating the date column in the target I will be using the Incoming date from a feed file and need to compare it with the currentDate() of the system if both are same then I need to populate a different column based on this condition. Since date columns cannot be compared or rather they need be either a character data or numeric one for comparison. thats the reason I m looking for a conversion to Integer.
Many Thanks,
Spendem
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Date to Integer Conversion
Hi Spendemspendem wrote:Hi,
Its working..... What I did is I converetd the dates to DateTostring in the stage variables
And then I used them at the derivation(Transformer Stage) as,
If AsInteger(Date1) = AsInteger(Date2) Then X Else Y.
Cheers,
Spendem
But I guess there is no need to conver it to String and then do the comparison as Integer. Dates can be directly compared. Just check for the datatypes of two fields. I guess it will solve the problem.
Regards
Ashwin