---
sourceDocument: Australia API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/api-reference

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Filter structure - iOS

# Filter structure - iOS {#ariaid-title1}

Release version: Australia  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read  
The Filter structure provides the ability to configure filters that
define the data to return in the return results of a REST endpoint query.

## Filter - init(criteria criteriaList: \[Criteria\], sortBy: \[Sort\]? = nil, queryCategory:
String? = nil) {#ariaid-title2}

Creates a filter based on one or more filter criteria that are OR'd
together.
{#filter-init_A_A_S__table_w5t_myg_kqb__entry__3}

| Name | Type | Description |
|-|-|-|
| criteria | Array | Top level criteria conditions to group with `OR` connectors. |
| sortBy | String | Optional. Sort order of the return results. Possible values: * asc: Ascending * desc: Desending Default: asc |
| queryCategory | String | Optional. Name of the query category. Default: None |
[Table 1. Parameters]

{#filter-init_A_A_S__table_w5t_myg_kqb} {#filter-init_A_A_S__table_x5t_myg_kqb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 2. Returns]

{#filter-init_A_A_S__table_x5t_myg_kqb}  
The following example shows creating three separate criteria and when passed in, if any of
those criteria are met, the record is passed back in the return results.

    // All of criteria1 conditions must be met
    let criteria1 = Criteria(conditions: ...)

    // OR all of criteria2 conditions must be met
    let criteria2 = Criteria(conditions: ...)

    // OR all of criteria3 conditions must be met
    let criteria3 = Criteria(conditions: ...)

    let filter = Filter(criterias: [criteria1, criteria2, criteria3])

## Filter - init(conditions: \[QueryProviding\], sorts: \[Sort\]? = nil) {#ariaid-title3}

Creates a filter based on all specified conditions (AND'd together)
{#filter-init_A_S__table_w15_nch_kqb__entry__3}

| Name | Type | Description |
|-|-|-|
| conditions | QueryProviding | Conditions to group with an `AND` connector. Possible values: * boolean * dateTime * email * integerChoice * numeric * reference * string * stringChoice {#filter-init_A_S__ul_sqz_5cc_3yb} |
| sorts | String | Optional. Sort order of the return results. Possible values: * asc: Ascending * desc: Desending Default: asc |
[Table 3. Parameters]

{#filter-init_A_S__table_w15_nch_kqb} {#filter-init_A_S__table_x15_nch_kqb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 4. Returns]

{#filter-init_A_S__table_x15_nch_kqb}  
The following code example shows how to call this function.

    // Where the record is active
    let condition1 = Condition.boolean(field: "active", .is(true))

    // AND the date value of the SLA due field is on "today" or any date after today.
    let condition2 = Condition.dateTime(field: "sla_due", .atOrAfter(0, .daysAgoStart))

    let filter = Filter(conditions: [condition1, condition2])

## Filter - init(query: String, queryCategory: String? = nil) {#ariaid-title4}

Creates a filter using a specified encoded query.
{#filter-init_S_S__table_jtk_5xg_kqb__entry__3}

| Name | Type | Description |
|-|-|-|
| query | String | [Encoded query](https://www.servicenow.com/docs/access?context=c_EncodedQueryStrings&version=australia&pubname=australia-platform-user-interface&ft:locale=en-US)[Encoded query](https://www.servicenow.com/docs/access?context=c_EncodedQueryStrings&version=australia&pubname=australia-platform-user-interface&ft:locale=en-US) to use to filter the records to return from the table. |
| queryCategory | String | Optional. Name of the query category to use for the query. |
[Table 5. Parameters]

{#filter-init_S_S__table_jtk_5xg_kqb} {#filter-init_S_S__table_ktk_5xg_kqb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 6. Returns]

{#filter-init_S_S__table_ktk_5xg_kqb}  
The following code example shows how to call this function.

    let query = "active=true^short_descriptionLIKEbroken"
    let filter = Filter(query: query)

## Filter - init(keywords: String? = nil, conditions: \[Condition\], sortBy: \[Sort\]? =
nil) {#ariaid-title5}

Creates a filter based on specific keywords and conditions that are AND'd
together.
{#filter-init_S_S_S__table_ltk_k1h_kqb__entry__3}

| Name | Type | Description |
|-|-|-|
| keywords | String | Optional. Any specific word or phrase to search for. Default: nil - No specific word search. |
| conditions | String | Conditions to group with an `AND` connector. Possible values: * boolean * dateTime * email * integerChoice * numeric * reference * string * stringChoice |
| sortBy | String | Optional. Sort order of the return results. Possible values: * asc: Ascending * desc: Desending Default: asc |
[Table 7. Parameters]

{#filter-init_S_S_S__table_ltk_k1h_kqb} {#filter-init_S_S_S__table_mtk_k1h_kqb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 8. Returns]

{#filter-init_S_S_S__table_mtk_k1h_kqb}  
<br />

    // Keyword that must be found in the record
    let searchTerm = "..."

    // AND the specified condition must be met
    let condition1 = Condition.email(field: "state", .changesFrom("4"))

    let filter = Filter(keywords: searchTerm, condition: condition1)


