# Field type queries

### General syntax

Use the following examples format for searching fields:

`fieldname:value`

Search a field by a value

`fieldname:"value with spaces"`

Search a field by a value containing spaces

`fieldname:[value1,value2]`

Show records with the field equal to any of these values

`fieldname:~value`

Search the field for words that sound like "value" on supported field

`fieldname:>=value`

For numbers and dates, use >, <, >= and <= operators for range searches

### Status <a href="#status-searches" id="status-searches"></a>

See also: [Status](/concepts-and-fundamentals/on-a-computer/using-the-datagrid/editing-items.md#status)

Return all items with the status Requested. You can replace Requested for any status appropriate to the register you are searching in.

`status:Requested`

Return all items with that are in both the status Requested & In Progress. You can replace these statuses for any appropriate statuses to the register you are searching in.

`status:["Requested","In Progress"]`

Returns all inactive items (ie Resolved, Closed)

`status:<0`

### ID <a href="#id-searches" id="id-searches"></a>

Search for a record by its record ID using text search:

`19388`

Record ID using id field name:

`id:19388`

### Date <a href="#date-fields" id="date-fields"></a>

See also: [Selecting Dates](/concepts-and-fundamentals/on-a-computer/using-the-datagrid/editing-items.md#selecting-dates)

When dealing with date fields you can use operators like greater than (`>)` or less than (`<`) to refine the search. To perform a range query, add the field twice to use each operator.

Search for items that were created since the start of 2019:

`dateCreated:>=2019-01-01`

The keyword "`now`" can be used as a shorthand for the current date and time.

Search for items that were updated within the past week:

`dateUpdated:>=now-1w`

Or, using days as a date unit:

`dateUpdated:>=now-7d`

Search for items that are overdue:

`due:<now`

Search for items that are due in the next week:

`due:<=now+1w`

Date shortcuts:

* M is for months
* m is for minutes
* y is for years
* w is for weeks
* d is for days
* now is for the current date and time

### Tags <a href="#tag-searching" id="tag-searching"></a>

See also: [Tagging items](/concepts-and-fundamentals/on-a-computer/using-the-datagrid/tagging-items.md)

Returns all items that have the tag “catering”

`tags:catering(#catering)`

Returns all items that are tagged with either “catering” or “communication”

`tags:catering OR tags:communication(#catering OR #communication)`

Returns all items that are tagged with both “catering” and “communication”

`tags:catering AND tags:communication(#catering AND #communication)`

Returns all items where no tags are set

`tags:none`

Returns all items where there are tags set for the item

`tags:any`

### Assignment <a href="#assignment-searching" id="assignment-searching"></a>

See also: [Assignment field](/concepts-and-fundamentals/on-a-computer/using-the-datagrid/editing-items.md#assignment)

Will return all items that are unassigned (ie no assignment).

`assigned:no`

Will return all items that are assigned to any position.

`assigned:yes`

Will return all items that are assigned to the MEMO Deputy position. You can replace MEMO Deputy with any other position name to search.

`assigned:"MEMO Deputy"`

For registers where you assign to a user, you can perform the following search to return items assigned to your user

`assigned:@me`

### Priority <a href="#priority-searches-for-registers-with-priority-field" id="priority-searches-for-registers-with-priority-field"></a>

The following searches will work in registers with a Priority field.

Return all items that are set as a high priority

`priority:High`

Return all items that are set to a low priority

`priority:Low`

Return all items that are set to a normal priority

`priority:Normal`

Return all items that are set to an urgent priority

`priority:Urgent`

### Related Items <a href="#related-item-searches" id="related-item-searches"></a>

See also: [Related Items](/concepts-and-fundamentals/on-a-computer/using-the-datagrid/viewing-items.md#embedded-and-related-items)

For any register you can search on whether a related item has been set or not

For example, on the request register, you can search for items with applicants or no applicants by using the ‘none’ and ‘any’ terms.

Return requests that have no applicants:

`applicant:none`

Return requests were the applicant has been set:

`applicant:any`

You can also search for fields within the related records:

`applicant:(firstName:Bob lastName:Down)`

### Media <a href="#media-searches" id="media-searches"></a>

See also: [Attaching Files](/concepts-and-fundamentals/on-a-computer/using-the-datagrid/editing-items.md#attaching-files)

For any register you can search on whether any of the media fields have media uploaded to them. For this you will need to know the name of the media field for the specific register you are searching on.

For example of the Recovery [Cases](broken://pages/Sfj9Pht3MY5OyzcTaJAs) register you can search for items have no photos uploaded into the Photos field:

`photos:none`

Similarly you can search for items where there are photos uploaded into the photos field:

`photos:any`

There is a second media field called Case Documents on the Recovery Case register. Similarly to the above example. you can search for items that have media in this field or no media in this field.

`caseDocuments:none caseDocuments:any`

### Geospatial <a href="#geospatial-operators" id="geospatial-operators"></a>

See also: [Location](/concepts-and-fundamentals/on-a-computer/using-the-datagrid/editing-items.md#location)

The CQL language supports two geospatial operations:

* `intersects:<area>` — returns records that touch the polygon defined by \<area>
* `within:<area>` — returns records that are wholly within the polygon defined by \<area>

You can combine any of the search options with AND, OR , NOT etc with geospatial region(s).

`intersects:yellowzone NOT intersects:redzone`

#### **Geography** <a href="#geography-searches" id="geography-searches"></a>

For any register you can search on whether the item contains geography data or not with the `any` and `none` search options. Geography data can either come from drawing on the map or the asset linked to the item.

`geo:none`

`geo:any`

#### **Within a predefine search area** <a href="#searching-items-within-a-predefine-search-area" id="searching-items-within-a-predefine-search-area"></a>

Search areas can be created and managed in the Library, as “Geospatial Features” with the search feature enabled:

`within:burnt-area-2020`

#### **Within another item** <a href="#searching-items-within-another-item" id="searching-items-within-another-item"></a>

Additionally, any register item’s geometry can be used by simply specifying its numeric ID as the \<area>.

This example shows searching one search area by its search reference (in this case, `burnt-area-2020`), and another by its direct ID.

`within:burnt-area-2020 within:12345`

**Using WKT**

Additionally, geospatial search areas can be defined using the geospatial WKT standard, wrapped in `”` quotes:

`intersects:"POLYGON((147.71232605287 -37.726696954216,147.70632098464 -37.722447990386,147.70980670525 -37.721037320531,147.71232605287 -37.726696954216))"`

WKT stands for “Well Known Text”, and most GIS systems allow polygons to be copied as WKT.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cw.crisisworks.com/security-and-support/technical-reference/cql-reference/cql-for-different-field-types.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
