Entering query expressions

The query expressions that you may enter are pieces of Scheme code which are used to test each entity and return a value of true or false.

If the entity satisfies the conditions of the expression, then it is shown in the contact list when you apply the system defined query in the Contacts workspace in NexJ CRM.

The most common kind of query you will use is a simple text search, where you will search a particular property for values matching a specified text string. To do this, enter (= (@<propertyname>) "<searchtext>") into the Query Value field (note that the search text must be enclosed in quotation marks). For example, if you wanted to find all contacts with a first name of 'John', you would enter (= (@ firstName) "John") into the Query Value field. The following is a table of common properties you may want to query for in a simple text search, as well as their property names:

Property names are case sensitive, with more complex properties requiring more than one word to return the desired query results.

Common text searches

Property

Property name

first name

firstName

last name (this is also used for the names of companies and households)

lastName

first three letters of last name

lastNameOneToThree

dear

dear

goes by

goesBy

default email address

emailAddress

company

company lastName

department

department lastName

household

household lastName

default street address

defaultAddress address1

default city

defaultAddress city

Another kind of query you can do determines if a fact about an entity is true or false. Variables that store true/false values about the entity are called boolean variables. For example, you may want to filter the entities so that only clients or entities with a coverage team are displayed. To do this, you must enter (= (@ <propertyname>) #t) in the Query Value field if you want the property to be true, and (= (@ <propertyname>) #f) if you want the property to be false, where the propertyname is determined by what you are searching for. The following is a table of common properties you may want to query for in a true/false search, as well as their property names:

Common boolean searches

Property

Property name

has at least one user covering it

isCovered

the searching user is the owner of this entity

isMine

has a default email

hasEmail

is a client

isClient

is a prospective client

isProspect

is a former client

isFormerClient

has client status set to Other

isOther

is being tracked by activity tracking system

isActTracking

is part of a household

hasHousehold

Finally, you may want to use the boolean operators andor, and not to further refine your system defined queries:

  • The and operator is followed by two or more different expressions and returns true only if all of them are true. For example, the code (and (= (@ firstName) "John") (= (@ isClient) #t)) would return a list of contacts whose first names are John and are current clients. You can also add more expressions, contained individually in parentheses, to the end of the current expression.

  • The or operator is followed by two or more different expressions and returns true if at least one of them is true. For example, the code (or (= (@ firstName) "John") (= (@ isClient) #t)) would return a list of contacts whose first names are John or are current clients. You can also add more expressions, contained individually in parentheses, to the end of the current expression.

  • The not operator is followed by an expression, and returns the opposite of the expression's value. For example, (not (= (@ firstName) "John")) would return a list of contacts whose first names are not John.

Adding system defined queries
Editing system defined queries