2 Replies Latest reply on Dec 5, 2012 7:11 PM by illbe

    Counting words to a punctuation mark

    illbe

      Title

      Counting words to a punctuation mark

      Post

           Can anyone tell me if there is a way to count the words that come before a coma in a text field?

           I have a text field that gets parsed into last name and first name, it also includes company names that may have more than one word before the coma (Big Shopping Store, The) and I would like to write a script that says that if the WordCount > 1 do not parse the field.

            

           Thank you in advance as usual :-)

            

           Tom

        • 1. Re: Counting words to a punctuation mark
          philmodjunk

               This will count all words up to the first comma in the text field:

               WordCount ( Left ( Table::TextField ; Position ( Table::TextField ; "," ; 1 ; 1 ) ) )

               This expression will extract all words to the left of the first comma:

               Let ( [ T = Table::TextField;
                         Wc = WordCount ( Left ( T ; Position ( T ; "," ; 1 ; 1 ) ) )
                       ];
                         Leftwords ( T ; Wc )
                     )

          • 2. Re: Counting words to a punctuation mark
            illbe

                 As we say in New York, Phil "You da man!". Thank you very much for the quick reply, it was just what I needed.

                  

                 All the best

                  

                 Tom