I have specific requirement like the column values can be as follows.
Ex: 10.20.001.25
10.20.001
20.12.35
20.12
Now the requirement I need to count the dot(.) in 10.20.001.25 and I will have to reduce one dot(.) from this string and find if it is existing ort. If it is not existing, then reduce by one more dot and compare in the existing set again.
So If pass 10.20.001.25 to the custom function then it should return 10.20.001
If I pass 20.12, then it is not in the existing data set even though after reduced by one dot (.) so it should return NULL.
Take the length of the whole string with dots and store it in a new field say length_with
Take the length of the whole string without dots and store it in a new field say length_without (It can be achived by using replace_substring func. Use the following code: replace_substring(field,’.’,’’)
Now if you do (length_without- length_with), will give you the count of the dots.