Click to copy

Finds one or several model objects in the database based on their fields and returns them.

Tip: all searches are case insensitive and search for a substring, corresponding to the SQL "ILIKE" statement with "%" around the search value (e.g. if you search for "Max" in "first_name", the SQL query would look like "first_name" ILIKE "%Max%").

Tip: you can use SQL Wildcards in your searches. For example, if you search for "ma%m", "Maxim" would be returned. If you pass these wildcards through a URL query parameter, make sure to encode them (i.e. "%" becomes "%25", while "_" can stay as is).

Tip: to pass an array through a URL query parameter, make sure to encode it in the following format "arrayName[]=element1&arrayName[]=element2" (e.g. "colors[]=red&colors[]=blue").

Flow Connections

  • [Input] In - starts the block's execution.
  • [Output] Out - activates when the block has finished its execution.

Data Connections

  • [Input] _Offset (integer, optional) - first row in the database to start the search from (index starting at 0).
  • [Input] _Limit (integer, optional) - maximum number of model objects to return.
  • [Input] _SortOrder (string, optional) - sort of the returned model objects (can either be "ASC" for ascending sort or ""DESC" for descending sort).
  • [Input] _SortBy (string, optional) - field by which the returned model objects will be sorted. The name of the field should be provided in lowercase snake case (e.g. "first_name").
  • [Input] _with (enum, optional) - data models connected to the target model object to retrieve from the database. Can then be used after expanding the found model object. Read more about _with in the Business Processes FAQ.
  • [Input] _Search (string, optional) - value to be searched for in multiple fields at the same time using OR logic (e.g. "first_name" = "Max" OR "last_name" = "Max").
  • [Input] _SearchIn (string array, optional) - fields to be searched for the value defined in _Search data input. Names of the fields should be provided in lowercase snake case (e.g. "first_name").
  • [Input] Fields (multiple, any) - field values to searched for. Any objects containing the said substring will be returned, the search is also case insensitive (e.g. if the value is set to "MAX" and an object's value in the database is "Maxim", it will be returned). The search is equivalent to the SQL "ILIKE" statement and any non-null inputs are combined using AND logic (e.g. "First Name" ILIKE "%Max%" AND "Last Name" ILIKE "%Parker%").
  • [Output] Data (model array) - model objects found in the database.
  • [Output] Count (integer) - number of model objects found.

In case the model you are searching for has one-to-many or many-to-many relations and you have selected the related model to be returned using the _with data input, you will also be able to define which related objects will be returned (by applying _Sort, _Search, and similar on them). Keep in mind that you will not be filtering the model being searched by these parameters, just the related models (see video above for more details).