Invalid conversion requested from a date to a int64

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
mjohnson62982
Participant
Posts: 20
Joined: Wed Nov 01, 2017 12:14 pm

Invalid conversion requested from a date to a int64

Post by mjohnson62982 »

I am trying to convert a decimal field to a date using the DateFromDaysSince function. The constraint looks like this;
DateFromDaysSince(CFPTA_Con.DSTRTA,'1900-01-01')
I am getting the following error while compiling.
Error in constraint expression for link DSLink4. Invalid conversion requested from a date to a int64.
Any help will be greatly appreciated.
Respectfully,
Matt Johnson
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

That function returns a DATE type, whereas a Transformer constraint expression is expected to evaluate to True or False--essentially an integer where zero represents False and 1 or other non-zero numbers represent True.

So, depending on what you're trying to accomplish, if you are indeed using a constraint on one of your output links, as opposed to a column derivation, then you may need to turn your expression into a True/False test, such as DateResultA = CurrentDate() or ThisDate > ThatDate.
Choose a job you love, and you will never have to work a day in your life. - Confucius
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You probably need to convert the decimal number to a string, and then that to an integer.

Or look at one of the Julian date functions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mjohnson62982
Participant
Posts: 20
Joined: Wed Nov 01, 2017 12:14 pm

Resolved

Post by mjohnson62982 »

I resolved this by putting the DateFromDaysSince() function in the Column Derivation field. Thanks for the help everyone.
Respectfully,
Matt Johnson
Post Reply