I am trying to return a count of all of the words in a multi-line text field using a "Calculated Text Field". Is there an in-built function to do this? The ".length" function returns the character count for the contents of the custom field. ".size" does not appear to work on the same custom field.
If there is not an in built way to do this, I was trying to loop through each character in the field looking for ' ' or '\n' which would indicate a new word, however this is error prone e.g. newlines appended to the end of the text.
Appreciate any guidance.
Not sure what version of JIRA you are using and what add-ons you have installed, but as far as I know, this isn't possible out of the box. We've done a similar thing using the ScriptRunner add-on. We simply created a Script Field and have the following code in it:
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObjectByName('fieldName')
String cFieldValue = issue.getCustomFieldValue(cField)
Hope this helps.
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events