# Program rule to check decimal places

**URL:** <https://community.dhis2.org/t/program-rule-to-check-decimal-places/35530>\
**Category:** Support - Assistance technique\
**Tags:** tracker\
**Created:** [28 March 2019 17:43 UTC](https://community.dhis2.org/t/program-rule-to-check-decimal-places/35530 "2019-03-28T17:43:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uaa](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/uaa/32/27542_2.png) [@Uaa](https://community.dhis2.org/u/Uaa)\
**Post date:** [28 March 2019 17:43 UTC](https://community.dhis2.org/t/program-rule-to-check-decimal-places/35530/1 "2019-03-28T17:43:22Z")

</div>

Dear all,  
Please, how do I set a program rule to check if the number entered exceeds 2 decimal places?

Thanks.  
Best,  
U’aa

---

<div class="post-metadata">

**Author:** ![Calle\_Hedberg](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/calle_hedberg/32/33875_2.png) [@Calle\_Hedberg](https://community.dhis2.org/u/Calle_Hedberg)\
**Post date:** [28 March 2019 22:55 UTC](https://community.dhis2.org/t/program-rule-to-check-decimal-places/35530/2 "2019-03-28T22:55:10Z")

</div>

@Uaa

You should be able to use a d2:validatePattern function with a RegEx pattern to identify any number with 3 decimals or more.

For the regex, try something like  
[0-9]+\.[0-9][0-9][0-9]  
(you need two backslashes since one is the escape character that DHIS2 usually requires)  
The regex should return true if the number has three decimals or more, but false if two or less

Regards  
Calle
