Filtering
Overview
ViewConnection queries support collection-specific filters to narrow down results. Filters vary by collection based on the data model.
Filter Types
Simple Value Filters
Filter by exact value or list of values:
query {
orderViewConnection(
first: 10
type: ["SALES_ORDER", "RETURN_ORDER"]
) {
edges {
node {
orderId
type
}
}
}
}Date Range Filters
Filter by date ranges:
query {
orderViewConnection(
first: 10
orderDate: { start: "2024-01-01", end: "2024-12-31" }
) {
edges {
node {
orderId
orderDate
}
}
}
}Number Range Filters
Filter by numeric ranges:
query {
productViewConnection(
first: 10
quantityOnHand: { start: 0, end: 100 }
) {
edges {
node {
productId
quantityOnHand
}
}
}
}Sequence Number Filters
Filter by ID sequences:
query {
orderViewConnection(
first: 10
sequence: { start: 1000, end: 2000 }
) {
edges {
node {
orderId
sequence
}
}
}
}Combining Multiple Filters
Filters can be combined in a single query:
query {
orderViewConnection(
first: 10
type: ["SALES_ORDER"]
status: ["OPEN", "IN_PROGRESS"]
orderDate: { start: "2024-01-01", end: "2024-12-31" }
) {
edges {
node {
orderId
type
status
orderDate
}
}
}
}Filter Behavior
- Multiple values in a filter are treated as OR (e.g.,
type: ["SALES_ORDER", "RETURN_ORDER"]) - Multiple different filters are treated as AND (e.g.,
typeANDstatus) - Empty or null filter values are ignored
Discovering Available Filters
Each collection has different available filters. To find filters for a collection:
- Check the collection's reference page (e.g.,
reference/order.md) - Use GraphQL introspection to query the schema
- Query the
dataSetMetaendpoint (advanced usage)
Filter Option Lists
Some filters have predefined valid values. These are documented in the reference pages for each collection.
Example: Order status filter might accept:
OPENIN_PROGRESSCOMPLETEDCANCELLED
Dynamic Filter Options
Some filter options vary by account based on:
- Custom fields defined for your account
- Integration-specific fields
- Location-specific settings
Use the reference documentation to identify which filters have fixed vs. dynamic option lists.
