contains(X;L)

Returns a boolean value indicating whether a given string contains any of the substrings in a given list.

Syntax

contains(X;L)

Input

Argument Type Description
X text The string to search for in the items in the list L

A scalar value or the name of a column

L text A space- or comma-separated list of text strings against which to compare X

Return Value

Returns an integer value of 1 if X contains any of the strings in the list L. Otherwise, returns 0.

If X is N/A, the result is 0.

Sample Usage

value list contains(value;list)
'banana' 'abc' 'nan' 'yz' 1
'banana' 'abc' 'yz' 0

Example

In the "Sales Item Detail" table (pub.demo.retail.item), you can find only those rows whose SKUs contain a "B". To do this, create a computed column and apply the contains(X;L) function to the sku column, where L is the list containing the string 'B'.

<base table="pub.demo.retail.item"/>
<willbe name="example" value="contains(sku;'B')"/>
<colord cols="sku,example"/>

For those values in the sku column that contain "B", the result is 1. Otherwise, the result is 0.