Skip to main content
Solved

DQ Accuracy Rule for Date datatype

  • August 4, 2023
  • 1 reply
  • 367 views

Forum|alt.badge.img+1

Hi Team,

I have tried to create Accuracy rule for Date datatype to check whether Date is in the standard format. 

Accurate rule should be as follows:

  • Standard date format is ‘MM-DD-YYYY’.
  • If date is entered in any format other than the above mentioned (‘DD-MM-YYYY’ or ‘YYYY-MM-DD’ or ‘YYYY-DD-MM’) then it should be considered as inaccurate.

When I tried using regex expression, I am getting error.

 

Any ideas?

Best answer by AKislyakov

Hi @anagha.k,

I suggest you change type of the input attribute to String. If your data is already stored as Date datatype it means it is already valid date and format is enforced by the source.

Yet if you need to check Date type field, I suggest removing implicit type conversion using variables and rewrite expression using toString function.

matches(@"^(\d{1,2})-(\d{1,2})-(\d{4})$", toString(input_dt, "dd-MM-yyyy"))

 

 

View original
Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img+2
  • Ataccamer
  • 146 replies
  • Answer
  • August 10, 2023

Hi @anagha.k,

I suggest you change type of the input attribute to String. If your data is already stored as Date datatype it means it is already valid date and format is enforced by the source.

Yet if you need to check Date type field, I suggest removing implicit type conversion using variables and rewrite expression using toString function.

matches(@"^(\d{1,2})-(\d{1,2})-(\d{4})$", toString(input_dt, "dd-MM-yyyy"))

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings