Skip to content

Where In using FrontQL

Introduction

In web applications, filtering data based on specific values is a common requirement. FrontQL allows you to filter data using the search query parameter with a specific syntax.

Implementing Where In

To filter data using the “where in” criteria with FrontQL:

  • Use the search query parameter to specify the criteria.
  • For a single value, format it as search: field::value.
  • For multiple values, format it as search: field::value1/value2/value3.

Example

Here are examples of how to implement the “where in” filter using FrontQL:

Single Value
async function getUsers() {
const response = await Api.get("/users", {
search: "post::1",
});
return response;
}
Multiple Values
async function getUsers() {
const response = await Api.get("/users", {
search: "post::1/2/3",
});
return response;
}

In these examples, the search query parameter filters the users table by the post field. For the single value example, it searches for records where post equals 1. For the multiple values example, it searches for records where post equals 1, 2, or 3.