Hey,
Can someone explain in plain English how the comparedigits function works?
Would really appreciate, if you can provide a use case as well!
Thanks in advance,
James.
---------
Below is an extract on comparedigits from the alteryx help:
CompareDigits(a,b, nNumDigits) Compares 2 numbers and determines if they are the same to the given number of digits. The comparison finds the difference between the numbers and reports A and B the same when the leading digit of the difference is NumDigits or more places to the right of the digits of the larger of A and B.
The NumDigits argument must not be null, and must be between 1 and 19, otherwise an error will result. If a non-integer is given, it is rounded to the nearest integer. (NumDigits can be between 0.5 and 19.499)
Example
CompareDigits(12345, 12444, 3)returns "True"
- because the difference is 99, and its leading digit is 3 places to the right of the leading digit of A.
CompareDigits(12345, 123445, 3)returns "False"
- because the difference is 100, and its leading digit is only 2 places to the right of the leading digit of A.
CompareDigits(12.345, 12.347, 3)returns "True"
- because the difference is 0.002, and its leading digit is 4 places to the right of the leading digit of A.
CompareDigits(12.345, 12.435, 3) returns "True"
- because the difference is 0.09, and its leading digit is 3 places to the right of the leading digit of A.
CompareDigits( .91234, .91334, 3) returns “False”
- because the difference is .001, and its leading digit is only 2 places to the right of the leading digit of A.