How to make a filter/search with QueryInterface

UI

Drag components and fields like this:

CODE

Inside your reserved code area, copy this:

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

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

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"));

Last updated