Skip to Content
0
Aug 16, 2016 at 06:07 AM

is_valid_date and raise an exception

445 Views

SAP DS version 4.2 SP 6

I have a datetime field with the following code

ifthenelse(

is_valid_datetime(Q_SELECT.TIJDSTIP, 'YYYY-MM-DD HH24:MI:SS')=1,

to_date(Q_SELECT.TIJDSTIP,'YYYY-MM-DD HH24:MI:SS'),

raise_exception ('for the given inputfile an value not equel to timestamp is found on field TIJDSTIP, hence aborted')

)

with validation this code is invalid:

[Query:Q_check_datatypes]

Invalid mapping expression for column <Q_check_datatypes.TIJDSTIP>. Additional information: <Cannot parse expression.

For the call to function <ifthenelse>, cannot convert parameter number <3> to type <INT>. Provide a parameter of the correct type.. (BODI-1112351)>. (BODI-1111081)

the only way around i can image is to split the functionality into 2 field, one for test and raise on invalidation of the timestamp and 1 for the actual conversion to datetime when the inputfield is valid....

Is my code indeed not correct or is this a bug in DS?