Hi Lusanda,
I don’t think there is any such function exists any where in the world to get the length of a numerical value without making the value a string first. And, conversion is absent in the DHIS. However, to achieve your target, you can use a calculated program rule variable which will be assigned by some program rules with checking some less than and greater than conditions.
Sorry, if it not works for you.