Date Validation


(Amy Wooten) #1

Example data set:

Admit Date-12/30/2015 18:13:00; Discharge Date-1/3/2016 18:45:00
and
CASE (
Admit_Date is null, TRUE,
tostring(Admit_Date,“YYYY-MM-DD HH:MM:SS”) is null, TRUE,
Admit_Date > Today(),TRUE,
DateDiff(Today(), Admit_Date, “YEAR”) > 2, TRUE,
TOSTRING(Discharge_Date_TIme,“YYYY-MM-DD HH:MM:SS”) is not null AND TOSTRING(Admit_Date,“YYYY-MM-DD HH:MM:SS”)>TOSTRING(Discharge_Date_TIme,“YYYY-MM-DD HH:MM:SS”), TRUE,
FALSE
)

When we use the above in DQC we see this example as an error although if go through each logic step, it should pass. Additionally when we take off this condition: TOSTRING(Discharge_Date_TIme,“YYYY-MM-DD HH:MM:SS”) is not null AND TOSTRING(Admit_Date,“YYYY-MM-DD HH:MM:SS”)>TOSTRING(Discharge_Date_TIme,“YYYY-MM-DD HH:MM:SS”), TRUE,
we do not see the error.

Any suggestions?


(Said Abduraimov) #2

Hi Amy,

Can you share the plan and the error you are receiving?


(Said Abduraimov) #3

Amy,

When we define all columns, ‘Admit_Date’, ‘Discharge_Time’, ‘Discharge_Date_TIme’, we do not receive any errors with your expression. Please, see the screenshot below:

However, when the ‘Discharge_Date_TIme’ column is not defined, we see the error and the error message states: Unknown column ‘Discharge_Date_TIme’…
If we remove the following line, as you do, we do not receive any errors.

TOSTRING(Discharge_Date_TIme,“YYYY-MM-DD HH:MM:SS”) is not null AND TOSTRING(Admit_Date,“YYYY-MM-DD HH:MM:SS”)>TOSTRING(Discharge_Date_TIme,“YYYY-MM-DD HH:MM:SS”), TRUE,

Do you encounter the same behaviour?