I am doing the Try it exercise of the Formula Tool Can anyone explain to me why
Formula - GetWord([Address], CountWords([Address])-1) within the Formula tool.
I just dont understand why within Countwords the string has Address and a -1. Why -1. If i omit
the -1 it gives a parse error.
Solved! Go to Solution.
Hi @mxledesma , as the question says you need to fetch the address suffix therefore, countword(address -1) it reads from backward. If you will use countword(address -2) then it will fetch Jasmine counting second word from the back.
Thanks!
Thanks
@mxledesma You're welcome.
@grazitti_sapna pls clarify if i need to use countword or getword to get suffix
Example : If the address is 376 S JASMINE ST and I need the address suffix (which is the last word of the address then how do I go about?)
Is anyone else getting the error "The field "" is not contained in the record"? I'm not sure how to interpret this even though I used the same formula as above.
Try removing the space before "countwords"
You need to create a Column named Suffix. Currently you do not have the formula tied to any column
Example: [Address] - 376 S JASMINE ST
Getword() function counts starting at 0. So 0,1,2,3.
Getword([Address], 0) = returns the very first word of the sentence = "376"
Countword() counts starting at 1. So 1, 2, 3, 4.
Solution:
Getword([Address],CountWords([Address])-1)
You have to add -1 because CountWord will return a 4, but GetWord sees the very last word as word #3.
I was working on this same problem in the examples, and what wasn't clear to me was the syntax of wrapping CountWords inside of GetWord. It kept throwing me an error with CountWords. The Help documentation only says to enter a string inside the parenthesis, but didn't explain in more detail. The -1 is the same concept used in Python, when counting from right to left.
GetWord([Address],CountWords([Address])-1)