Skip to content

Filtering

Searching resources is performed in URL. The filtering is always composed by URL segment that defines column to filter on and next URL segment that is value. Here's an example of a URL that uses all filtering options

See proper section for more details: Exact Value, Or, And, Search by Substring, Search by Ranges and Advanced Data Navigation

Data Types

  • String use urlencoding in case of non-ascii characters
  • Number use integers or float with "." (dot) for decimal separator
  • Date use ISO format (YYYY-MM-DD)
  • Datetime use ISO formats

    • YYYY-MM-DD hh🇲🇲ss
    • YYYY-MM-DD hh🇲🇲ss.uuuuuu
    • YYYY-MM-DDThh🇲🇲ss
    • YYYY-MM-DDThh🇲🇲ss.uuuuuu

where:
YYYY - four digit year e.g. 2018
MM - two digit month e.g. 12
DD - two digit day e.g. 31
hh - two digit hour e.g. 23
mm - two digit minute e.g. 59
ss - two digit second e.g. 59
uuuuuu - six digit microsecond e.g. 999999

Exact Value

The simplest filtering is by exact comparison.

Usage:

/[column_name]/[value]

Examples:
https://demo.slashdb.com/db/Chinook/Customer/Country/USA - get Customers from USA


OR

You can separate values with "," (comma) to compare with multiple values. This effectively works like an "or".

Usage:

/[column_name]/[value1],[value2]

Examples:

https://demo.slashdb.com/db/Chinook/Customer/Country/USA,Canada - get Customers from USA or Canada


AND

You can combine filtering on multiple columns which effectively works like and "and". You can combine as many, as you need.

Usage:

/[column_A]/[value_for_A]/[column_B]/[value_for_B]

Examples:

https://demo.slashdb.com/db/Chinook/Customer/Country/USA/City/New York - get Customers from New York, USA.


NOT (negation)

Negation can be applied to any filter (i.e. exact value, substring, etc.) to obtain records other than the ones matching the given filter. Prefix the filtered field with the ~ (tilde) character to invert the filtering condition for that field.

Usage:

/~[column_name]/[filter]

Examples:

https://demo.slashdb.com/db/Chinook/Customer/~Country/USA - get Customers from anywhere except the USA.

https://demo.slashdb.com/db/Chinook/Customer/~Country/USA,Canada - get Customers from anywhere except the USA or Canada.

https://demo.slashdb.com/db/Chinook/Track/~TrackId/1..3495 - get Tracks with TrackId outside of the range of 1 to 3495.


Search by Substring

It's also possible to search by matching substring. In general "*" (asterisk) means any characters. It's also possible to search asterisk literally but then you need to override default wildcard character.

Usage:

/[column_name]/[starts_with_string]*
/[column_name]/*[ends_with_string]
/[column_name]/[starts_with_string]*[ends_with_string]
/[column_name]/*[contains_string]*

Examples:

https://demo.slashdb.com/db/Chinook/Customer/LastName/M* - get only Customer with LastName starting with letter M
https://demo.slashdb.com/db/Chinook/Customer/LastName/M*r - get only Customer with LastName starting with letter "M" and ending with letter "r".
https://demo.slashdb.com/db/Chinook/Customer/City/*ar* - get only Customers from Cities that have "ar" somewhere in their name.


Search by Ranges

For numeric values (integer, float, date) can filter by a range.

  • Greater or equal
  • Less or equal
  • Between

Usage:

/[column_name]/[value]..
/[column_name]/..[value_to]
/[column_name]/[value_from]..[value_to]

Examples:

https://demo.slashdb.com/db/Chinook/Invoice/Total/9.91.. - get Invoices of Total value ≥ 9.91

https://demo.slashdb.com/db/Chinook/Invoice/Total/..1.98 - get Invoices of Total value ≤ 1.98

https://demo.slashdb.com/db/Chinook/Invoice/CustomerId/1..5.html - get Invoices of Customer with CustomerId between 1 and 5.

Column filter

It's possible to select only certain columns. See section about selecting single column or multiple columns.