Filter class - Android
The Filter class provides the ability to configure filters that define the data to return in the return results of a REST endpoint query.
| Name | Type | Description |
|---|---|---|
| queryItems | Map<String, String> | Collection of query items representing the filter. |
Filter - Filter(conditions: List<Condition>, keywords: String? = null, sortBy: List<Sort>? = null)
Creates a filter based on specific keywords and conditions that can be OR'd or AND'd together.
| Name | Type | Description |
|---|---|---|
| conditions | List<Condition> | Simple or compound conditions to add to the query. Possible conditions:
|
| keywords | String | Optional. Any specific word or phrase to search for. Default: nil - No specific word search. |
| sortBy | List<Sort> | Optional. List of record field names and the associated sort order constant to sort the returned records by. For example: val sortBy = listOf("zipcode", ORDER_DESC)If you include multiple sort fields, each subsequent field is a further sort of the prior field(s). Valid sort values:
Default: ORDER_ASC |
| Type | Description |
|---|---|
| None |
// Where the record is active
val condition1 = BooleanSimpleCondition.conditionIs("active", true)
// AND the date value of the SLA due field is on "today" or any date after today.
val condition2 = DateSimpleTimeCondition.atOrAfter("sla_due", 0, ConditionUtils.DateTimeValueOperator.daysAgoStart)
val filter = Filter(conditions = listOf(condition1, condition2))
Filter - Filter(criteriaList: List<Criteria>, sortBy: List<Sort>? = null)
Creates a filter based on one or more filter criteria that are OR'd together.
| Name | Type | Description |
|---|---|---|
| criteriaList | List<Criteria> | Top level criteria conditions to group with OR connectors. |
| sortBy | List<Sort> | Optional. List of record field names and the associated sort order constant to sort the returned records by. For example: val sortBy = listOf("zipcode", ORDER_DESC)If you include multiple sort fields, each subsequent field is a further sort of the prior field(s). Valid sort values:
Default: ORDER_ASC |
| Type | Description |
|---|---|
| None |
val activeIncidents = BooleanSimpleCondition.conditionIs("active", true)
val assignedToEmpty = StringSimpleCondition.isEmpty("assigned_to")
val assignedToAbel = StringSimpleCondition.conditionIs("assigned_to", "Abel Tuter")
val assignedToAbelOrEmpty = CompoundCondition(ConditionUtils.CompoundOperator.OR, listOf(assignedToEmpty, assignedToAbel))
val needToReassign = Criteria().addConditions(listOf(activeIncidents, assignedToAbelOrEmpty))
val highEscelations = StringSimpleCondition.conditionIs("escalation", "2")
val overdueEscelations = StringSimpleCondition.conditionIs("escalation", "3")
val highOrOverdueEscelations = CompoundCondition(ConditionUtils.CompoundOperator.OR, listOf(highEscelations, overdueEscelations))
val needToHandleEscalation = Criteria().addCondition(highOrOverdueEscelations)
val myPrioritiesForTodayFilter = Filter(listOf(needToReassign, needToHandleEscalation))