TableQuery interface

Methods

and(string, any[])

Specifies an AND where condition.

Example

var tableQuery = new TableQuery()
                     .where('Name == ? or Name <= ?', 'Person1', 'Person2');
                     .and('Age >= ?', 18);
or(string, any[])

Specifies an OR where condition.

Example

var tableQuery = new TableQuery()
                     .where('Name == ? or Name <= ?', 'Person1', 'Person2');
                     .or('Age >= ?', 18);
select(string[])

Specifies the select clause. If no arguments are given, all fields will be selected.

Example

var tableQuery = new TableQuery().select('field1', 'field2');
select(string[])
top(number)

Specifies the top clause.

Example

var tableQuery = new TableQuery().top(10);

// tasktable should already exist and have entities
tableService.queryEntities('tasktable', tableQuery, null /*currentToken*/, function(error, result) {
  if(!error) {
    var entities = result.entities; // there will be 10 or less entities
    // do stuff with the returned entities if there are any
    // if result.continuationToken exists, to get the next 10 (or less) entities
    // call queryEntities as above, but with the returned token instead of null
  }
});
toQueryObject()

Returns the query string object for the query.

where(string, any[])

Specifies the where clause.

Valid type specifier strings include: ?string?, ?bool?, ?int32?, ?double?, ?date?, ?guid?, ?int64?, ?binary? A type must be specified for guid, int64, and binaries or the filter produced will be incorrect.

Example

var tableQuery = new TableQuery().where(TableQuery.guidFilter('GuidField', QueryComparisons.EQUAL, guidVal));
OR
var tableQuery = new TableQuery().where('Name == ? or Name <= ?', name1, name2);
OR
var tableQuery = new TableQuery().where('Name == ?string? && Value == ?int64?, name1, int64Val);

// tasktable should already exist and have entities
tableService.queryEntities('tasktable', tableQuery, null /*currentToken*/, function(error, result, response) {
  if(!error) {
    var entities = result.entities;
    // do stuff with the returned entities if there are any
  }
});

Method Details

and(string, any[])

Specifies an AND where condition.

Example

var tableQuery = new TableQuery()
                     .where('Name == ? or Name <= ?', 'Person1', 'Person2');
                     .and('Age >= ?', 18);
function and(condition: string, args: any[]): TableQuery

Parameters

condition

string

The condition string.

args

any[]

Returns

TableQuery

A table query object with the and clause.

or(string, any[])

Specifies an OR where condition.

Example

var tableQuery = new TableQuery()
                     .where('Name == ? or Name <= ?', 'Person1', 'Person2');
                     .or('Age >= ?', 18);
function or(condition: string, args: any[]): TableQuery

Parameters

condition

string

The condition.

args

any[]

Returns

TableQuery

A table query object with the or clause.

select(string[])

Specifies the select clause. If no arguments are given, all fields will be selected.

Example

var tableQuery = new TableQuery().select('field1', 'field2');
function select(args: string[]): TableQuery

Parameters

args

string[]

Returns

TableQuery

A table query object with the select clause.

select(string[])

function select(args: string[]): TableQuery

Parameters

args

string[]

Returns

TableQuery

top(number)

Specifies the top clause.

Example

var tableQuery = new TableQuery().top(10);

// tasktable should already exist and have entities
tableService.queryEntities('tasktable', tableQuery, null /*currentToken*/, function(error, result) {
  if(!error) {
    var entities = result.entities; // there will be 10 or less entities
    // do stuff with the returned entities if there are any
    // if result.continuationToken exists, to get the next 10 (or less) entities
    // call queryEntities as above, but with the returned token instead of null
  }
});
function top(top: number): TableQuery

Parameters

top

number

The number of items to fetch.

Returns

TableQuery

A table query object with the top clause.

toQueryObject()

Returns the query string object for the query.

function toQueryObject(): Object

Returns

Object

JSON object representing the query string arguments for the query.

where(string, any[])

Specifies the where clause.

Valid type specifier strings include: ?string?, ?bool?, ?int32?, ?double?, ?date?, ?guid?, ?int64?, ?binary? A type must be specified for guid, int64, and binaries or the filter produced will be incorrect.

Example

var tableQuery = new TableQuery().where(TableQuery.guidFilter('GuidField', QueryComparisons.EQUAL, guidVal));
OR
var tableQuery = new TableQuery().where('Name == ? or Name <= ?', name1, name2);
OR
var tableQuery = new TableQuery().where('Name == ?string? && Value == ?int64?, name1, int64Val);

// tasktable should already exist and have entities
tableService.queryEntities('tasktable', tableQuery, null /*currentToken*/, function(error, result, response) {
  if(!error) {
    var entities = result.entities;
    // do stuff with the returned entities if there are any
  }
});
function where(condition: string, args: any[]): TableQuery

Parameters

condition

string

The condition string.

args

any[]

Returns

TableQuery

A table query object with the where clause.