Search.../

gt( )

Developer Preview

Refines a query to match items where the specified property is greater than the specified value.

Description

The gt() function refines a FieldsQueryBuilder to match only items where the value of the specified propertyName is greater than the specified value. gt() matches only values of the same type. For example, 0 stored as a number doesn't match '0' stored as a string. If a property contains a number stored as a string (for example, '0'), that value is compared alphabetically and not numerically. If a property doesn't have a value, that value is ranked lowest. The following types of properties can be compared:

  • Number: Compares numerically.
  • Date: Compares JavaScript Date objects.
  • String: Compares lexicographically, so 'abc' is greater than 'ABC'.

Syntax

function gt(propertyName: string, value: any): FieldsQueryBuilder

gt Parameters

NAME
TYPE
DESCRIPTION
propertyName
Optional
string

Property whose value is compared with value.

value
Optional
any

Value to compare against.

Returns

Return Type:

Was this helpful?

Add a gt filter to a query

Copy Code
1const query = extendedFields.queryExtendedFields.gt(
2 '_createdDate',
3 '2021-03-01'
4);
5
Create a query, add a gt filter, and run it

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