Word Count

Options
Sean_510793
Sean_510793 Posts: 69 admin

Hi, I recently came across a need to do a word count and used the following field formula. Thought it might be useful for others.

input = fields['field-name'];

var text = input.split(' ');
var wordCount = 0;
for (var i = 0; i < text.length; i++) {
  if (text[i] !== ' ') {
    wordCount++;
  }
}
result = wordCount;
Tagged: