Crystal Reports – How to test if string contains

The following formula shows how to test if a text field contains particular text.

For example:

ValueFormulaResult
a quick brown foxInStr( {value}, ‘red’ )false
a quick brown foxInStr( {value}, ‘brown’ )true

Note: the InStr function is case sensitive – if you want to test case insensitive you need to convert the value to lowercase first. For example

InStr( lcase( {value} ), 'brown' ) > 0

Reference: http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=2409

Was this article helpful?

Related Articles