Search.../

ne( )

Refines a query to match items whose specified property value does not equal the specified value.

Description

The ne() function refines a ContactsQueryBuilder to only match items where the value of the specified property does not equal the specified value.

It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.

Matching strings with ne() is case sensitive in most instances, so "text" is not equal to "Text". One exception is email fields, which are case insensitive when matching with ne().

If the value of the propertyName property is an Array, ne() includes items in which none of the elements of the Array match the specified value.

Syntax

function ne(propertyName: string, value: *): ContactsQueryBuilder

ne Parameters

NAME
TYPE
DESCRIPTION
propertyName
string

The property whose value will be compared with value.

Supported properties:

  • "_id"
  • "_createdDate"
  • "_updatedDate"
  • "lastActivity.activityDate"
  • "primaryInfo.email"
  • "primaryInfo.phone"
  • "info.name.first"
  • "info.name.last"
  • "info.emails.email"
  • "info.phones.phone"
  • "info.addresses.street"
  • "info.addresses.city"
  • "info.addresses.subdivision"
  • "info.addresses.country"
  • "info.company"
  • "info.jobTitle"
  • "info.birthdate"
  • "info.locale"
value
*

The value to match against.

Returns

A ContactsQueryBuilder object that contains the refined query.

Was this helpful?

Add an ne filter to a query

Copy Code
1const query = contacts.queryContacts().ne("info.company", "Wix");
Create a query, add an ne filter, and run it

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { contacts } from 'wix-crm-backend';
3
4export const myQueryContactsFunction = webMethod(Permissions.Anyone, () => {
5 return contacts.queryContacts()
6 .ne("info.addresses.country", "GB")
7 .find()
8 .then((results) => {
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 case where no matching items found
21 }
22 })
23 .catch((error) => {
24 console.error(error);
25 })
26
27});