Sera Posted February 27, 2013 Posted February 27, 2013 Ok... I'm now at the frustrated point when I know that I *should* be able to do it, but I can't find the answers because I think that I'm google-fu-ing the wrong words. I have a field that captures a Title, which consists of a variable amount of words. What I want is a flag (or a "yes") when the Title field contains specific keywords. I know what the keywords are. Ultimately, I want to apply the same thing to a description field using the same set of keywords. I know I'm gonna kick myself when I figure it out, but any help would be appreciated.
Kris M Posted February 28, 2013 Posted February 28, 2013 PatternCount is the function you want to look at.. perhaps
LaRetta Posted February 28, 2013 Posted February 28, 2013 Hi Sera, I believe that, if you have a description with multiple words in the paragraph and you have a list of keywords then PatternCount() would not work for comparison unless you iterate through the keywords comparing each individually. I might be wrong but I think you need recursion. Attached is a simple custom function which should work for you. For those with prior versions, it would be: /* LaRetta Kwandt 2013-2-28 Format IsWithin ( string ; values ) Parameters string - any text string values - a return-delimited list of text values Data type returned text Description Takes a field of text and compares to individual values and counts how many words match. */ Let ( [ value = LeftWords ( string ; 1 ) ; exists = not IsEmpty ( FilterValues ( values ; value ) ) ] ; exists + Case ( WordCount ( string ) ; IsWithin ( RightWords ( string ; WordCount ( string ) - 1 ) ; values ) ) ) IsWithin.zip
Sera Posted March 1, 2013 Author Posted March 1, 2013 Oh frabjous! LaRetta, this is exactly what I needed. Thank you!!! I am no longer frustrated. Woot! Kris M, thank you for the assist. I can use PatternCount() for a different issue!
Recommended Posts
This topic is 4624 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now