Get the number of occurances of a string

I am trying to calculate the number of times updatedby is present in the string - [{“id”: “123”, “updatedBy”: “[“aaa”]”, “value”: “xyz”}, {“id”: “234”, “updatedBy”: “[“bbb”]”, “value”: “xyzz”}, {“id”: “345”, “updatedBy”: “[“aaa”]”, “value”: “xyzz”}, {“id”: “456”, “updatedBy”: “[“ccc”]”, “value”: “jjdjd”}]

Hi @Aneesha_Gattamaneni -

You can use this approach. I’ve added a parameter to show this example but it’s not necessary.

1. Create a parameter for the search string.
image

2. Create a calculated field to count the occurrences. This works by comparing the length of your string with and without the search string.

(strlen(string)-strlen(replace(toLower(string), toLower(${searchfor}),'')))
/
strlen(${searchfor})

3. You can use the calculated field as dim or value

3 Likes