Search.../

startsWith( )

Developer Preview

Refines a query to match items where the specified property starts with the specified value.

Description

The startsWith() function refines a LabelsQueryBuilder to match only items where the value of the specified propertyName starts with the specified string. Matching with startsWith() is case-sensitive, so 'TEXT' doesn't start with 'text'. You can only use startsWith() with a property whose value is a string.

Syntax

function startsWith(propertyName: string, value: string): LabelsQueryBuilder

startsWith Parameters

NAME
TYPE
DESCRIPTION
propertyName
Optional
string

Property whose value is compared with string.

value
Optional
string

Returns

Return Type:

Was this helpful?

Add a startsWith filter to a query

Copy Code
1const query = labels.queryLabels.startsWith('displayName', 'L');
2
Create a query, add a startsWith filter, and run it

Copy Code
1import { labels } from 'wix-crm.v2';
2
3export async function myQueryFunction() {
4 const results = await labels.queryLabels();
5 startsWith('displayName', 'L').find();
6
7 if (results.items.length > 0) {
8 const items = results.items;
9 const firstItem = items[0];
10 const pageSize = results.pageSize;
11 const hasNext = results.hasNext();
12 const hasPrev = results.hasPrev();
13 const length = results.length;
14 const query = results.query;
15
16 return items;
17 } else {
18 // Handle if no matching items found
19 }
20}
21