Skip to main content
Solved

How can we check decimal value in ONE WEB ?


Forum|alt.badge.img+1

How can we do decimal validation in Ataccama one web DQ rules.

 

input attribute data type should be float for this rule.

 

 

Best answer by MayKwok

I tested this on my test data set (postgres db source), so I’ll be very interested to see if it works for you.

 

Let’s say my rule attribute is value1 (float) type.

 

For my rule condition I’ve put, in Advanced Expression form:

indexOf(toString(value1),”.”) is null

 

This casts the value1 to string, then check if it contains a decimal point. If it doesn’t contain it, then the expression evaluates to “true”.

 

In Ataccama ONE DQ rules, the default mode is that if condition is met, then record is INVALID, else VALID. So the above expression will flag any records that doesn’t contain the decimal point, as INVALID.

 

You may wish to extend the expression to this to also cater for if the database stores the decimal as a comma, like so:

indexOf(toString(value1),”.”) is null or indexOf(toString(value1),”,”) is null

 

Please give it a try and let us know how it goes! Hope this helped?

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

4 replies

Forum|alt.badge.img+3
  • Data Pioneer L2
  • 16 replies
  • October 17, 2022

Hi Mahesh,

Can you elaborate on what you mean by decimal validation? It would be great if you could provide an example of some values that would pass / fail your rule?

Thanks!


Forum|alt.badge.img+1
  • Author
  • Data Pioneer
  • 6 replies
  • October 18, 2022

Thanks Maykwak for your response . 

valid case like : 10.02 ,10,00 (without decimal value should be invalid)

Invalid case like : 10 


Forum|alt.badge.img+3
  • Data Pioneer L2
  • 16 replies
  • Answer
  • October 19, 2022

I tested this on my test data set (postgres db source), so I’ll be very interested to see if it works for you.

 

Let’s say my rule attribute is value1 (float) type.

 

For my rule condition I’ve put, in Advanced Expression form:

indexOf(toString(value1),”.”) is null

 

This casts the value1 to string, then check if it contains a decimal point. If it doesn’t contain it, then the expression evaluates to “true”.

 

In Ataccama ONE DQ rules, the default mode is that if condition is met, then record is INVALID, else VALID. So the above expression will flag any records that doesn’t contain the decimal point, as INVALID.

 

You may wish to extend the expression to this to also cater for if the database stores the decimal as a comma, like so:

indexOf(toString(value1),”.”) is null or indexOf(toString(value1),”,”) is null

 

Please give it a try and let us know how it goes! Hope this helped?


Forum|alt.badge.img+1
  • Author
  • Data Pioneer
  • 6 replies
  • October 26, 2022

Maykwak it is working fine.Thanks😀


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