Refines a query or filter to match items whose specified property value contains a specified string.
The contains()
function refines a WixDataQuery
or WixDataFilter
to
only match items where the value of the specified property contains the
specified string
. Matching with contains()
is not case sensitive, so
"text"
does contain "Tex"
.
You can use contains()
with a property whose value is a String or a Reference.
For properties of type reference it is recommended that you use the eq()
function instead of contains()
. With properties that are References, contains()
matches by the ID of the referenced item as a String.
function contains(propertyName: string, string: string): WixDataQuery;
The property whose value will be compared with the string.
The string to look for inside the specified property value.
let newQuery = query.contains("description", "some words");
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.