String manipulation

COUNTOF – Count string instances

134 views June 1, 2018 February 10, 2019 admin 0

Overview

This Custom Field counts the number of instances of one specified string inside of another.

Syntax

COUNTOF(FIELDSTR(Description),‘Bl’)

Example

Element Description
FIELDSTR(Description) The string to search in.
String The string to search for.

COUNTOF(FIELDSTR(‘Colours’), ‘Bl’)

In the following list of colours, the above Custom Field query will return the following:

Colours COUNTOF(FIELDSTR(‘Colours’), ‘Bl’)
Green 0
Dark Green 0
Grey/Green 0
Blue 1
Black/Blue 2
Grey/Blue 1
Yellow 0
Grey 0
Black 1

COUNTOF(FIELDSTR(‘Colours’), ‘Gre’)

In the following list of colours, the above Custom Field query will return the following:

Colours COUNTOF(FIELDSTR(‘Colours’), ‘Gre’)
Green 1
Dark Green 1
Grey/Green 2
Blue 0
Black/Blue 0
Grey/Blue 1
Yellow 0
Grey 1
Black 0

See also

CONTAINSANY

CONTAINSALL

FINDFIELDCONTAINING

 

Was this helpful?