Hi pros, please help to read this formula. The purpose of the formula is to filter out same-digit numbers. e.g. 111, 4444 or 777.7 etc. I want to understand how the following formula worked.
PadLeft("", Length([Temp_sum]), Left([Temp_sum], 1))=[Temp_sum]
Solved! Go to Solution.
Hello @khayitof ,
What the formula is saying in this case is:
Take the first character from the cell, repeat it itself a number of times equal to the number of characters in each cell.
If that number then is equal to the number in the field then "True" else go through "False"
Regards
@khayitof
PadLeft("", Length([Temp_sum]), Left([Temp_sum], 1))=[Temp_sum]
1. Left([Temp_sum], 1)) : first character of [Temp_sum]
2. Length([Temp_sum]): Length of [Temp_sum]
3. Meaning creating a string with first character of [Temp_sum] with length of [Temp_sum]
4. Then if it is same with [Temp_sum] itselft, it is true.
5. Basically to check if [Temp_sum] is made of same characters or not.
Same AAAAA, it will true and it will false if its ABAA.
Hi @khayitof
It's an interesting use of the padleft() function!
For is to work Temp_sum has to be a text field.
Padleft(String, len, char) is the default configuration for padleft.
In this case:
String = "", i.e. nothing
len = Length([Temp_sum]), i.e. the number of digits in Temp_sum
char = Left([Temp_sum], 1), i.e. the 1st digit of Temp_sum
So the result of PadLeft("", Length([Temp_sum]), Left(Temp_sum,1)) is a string that is the same number of characters as Temp_sum, but the 1st character replicated.
The filter tool then tests this against Temp_sum and if they are the same, you know that Temp_sum is a same digit number.
@afv2688 Thank you. It was very helpful!
@Qiu Thank you, it was very helpful