Search.../

skip( )

Sets the number of items to skip before returning query results.

Description

The skip() function defines the number of results to skip in the query results before returning new query results.

For example, if you query your contacts and 50 items match your query, but you set skip to 10, the results returned will skip the first 10 items that match and return the 11th through 50th items.

By default, skip is set to 0.

Syntax

function skip(skip: string): LabelsQueryBuilder

skip Parameters

NAME
TYPE
DESCRIPTION
skip
string

The number of items to skip in the query results before returning the results.

Returns

A LabelsQueryBuilder object that contains the refined query.

Return Type:

Was this helpful?

Add a skip to a query

Copy Code
1const query = contacts.queryLabels().skip(10);
Create a query, add a skip, and run it

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { contacts } from 'wix-crm-backend';
3
4export const myQueryLabelsFunction = webMethod(Permissions.Anyone, async () => {
5 try {
6
7 const results = await contacts.queryLabels()
8 .skip(10)
9 .find();
10
11 if (results.items.length > 0) {
12 const items = results.items;
13 const firstItem = items[0];
14 const pageSize = results.pageSize;
15 const hasNext = results.hasNext();
16 const hasPrev = results.hasPrev();
17 const length = results.length;
18 const query = results.query;
19
20 return items;
21 } else {
22 // Handle case where no matching items found
23 }
24
25 } catch (error) {
26 console.error(error);
27 // Handle the error
28 }
29});