wire.data.TableQuery

The TableQuery class is used to create queries. Use the wire.data.select method to create TableQuery instances.

The following makes a call to a custom web service method GetUsers and returns the results into the data variable.

const accountService = new wire.data.DataSource("custom", {
    ...
});

const query = wire.data.select().from("GetUsers")

const data = accountService.exec(query);

TableQuery has many methods which allow a target data source to be queried. Check the target service provider documentation for details including support for TableQuery.

The full list of wire.data.select methods available is listed below.

 wire.data.select([fields])
 
  [.top(number)]
  [.distinct()]
  [.field(field)]
    [.eventName(name)]
 
  .from([entity])
 
  [.join(entity)]
  [.leftJoin](entity)]
  [.rightJoin](entity)]
  [.on(entity,field)]
  [.onValue(field, value)]
 
  [.where([custom expression])]
    [.expression(expression)]
    [.eq(field,value)]
    [.ne(field,value)]
    [.in(field,[values])]
    [.between(field,value1,value2)]
    [.starts(field,value)]
    [.contains(field,value)];
    
  [.groupBy(fields)]
  [.orderBy(field, [desc])]

The following example selects the list of active users directly from a SQL database using the WireBootstrap Query Service.

const accountService = new wire.data.DataSource("table", {
    ...
});

const query = wire.data.select("UserName")
    .from("Users")
    .where().eq("Active", true);
    
const table = accountService.exec(query);

For more TableQuery examples, visit Creating Queries - Select Queries.

Last updated