# How to make a filter/search with QueryInterface

## UI

Drag components and fields like this:

![](/files/-LBVXEwxDJLDqN0l7Tab)

## CODE

Inside your reserved code area, copy this:

```java
QueryInterface query = Core.query(Core.defaultConnection(),"SELECT id as id,email as email,name as name")
  .from("tbl_person");

if(Core.isNotNull(model.getEmail()))
 query.where("email=:email").addString("email", model.getEmail());
if(Core.isNotNull(model.getName()))
  query.where("name=:name").addString("name", model.getName());

model.loadTable_1(query);
```

Query List Row

```java
QueryInterface query = Core.query("conn_app_pg","SELECT id,name,email FROM public.persons");
ResultSet.Record o = query.getRecordList();
o.RowList.forEach(r->{
    System.out.println(r.getInt("id")+":"+r.getString("name")+":"+r.getString("email"));
});
```

Query Single Row

```java
QueryInterface query = Core.query("conn_app_pg","SELECT id,name,email FROM public.persons");
ResultSet.Record o = query.getSigleRecord();
System.out.println(o.getInt("id")+":"+o.getString("name")+":"+o.getString("email"));
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nosicode.gitbook.io/faq/intermediate/how-to-make-a-filter-search-with-queryinterface.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
