Class: TableQuery

TableQuery


new TableQuery()

Creates a new TableQuery object.

Source:

Methods


<static> binaryFilter(propertyName, operation, value)

Generates a property filter condition string for a 'binary' value.

Parameters:
Name Type Description
propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.
See Constants.TableConstants.QueryComparisons for a list of allowed operations.

value string | buffer

A 'buffer' containing the value to compare with the property.

Source:
Returns:

A string containing the formatted filter condition.

Type
string
Example
var query = TableQuery.binaryFilter('BinaryField', QueryComparisons.EQUAL, Buffer.from('hello'));

<static> booleanFilter(propertyName, operation, value)

Generates a property filter condition string for a 'boolean' value.

Parameters:
Name Type Description
propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.
See Constants.TableConstants.QueryComparisons for a list of allowed operations.

value string | boolean

A 'boolean' containing the value to compare with the property.

Source:
Returns:

A string containing the formatted filter condition.

Type
string
Example
var query = TableQuery.booleanFilter('BooleanField', QueryComparisons.EQUAL, false);

<static> combineFilters(filterA, operatorString, filterB)

Creates a filter condition using the specified logical operator on two filter conditions.

Parameters:
Name Type Description
filterA string

A string containing the first formatted filter condition.

operatorString string

A string containing the operator to use (AND, OR).

filterB string

A string containing the second formatted filter condition.

Source:
Returns:

A string containing the combined filter expression.

Type
string
Example
var filter1 = TableQuery.stringFilter('Name', QueryComparisons.EQUAL, 'Person');
var filter2 = TableQuery.booleanFilter('Visible', QueryComparisons.EQUAL, true);
var combinedFilter = TableQuery.combineFilters(filter1, TableUtilities.TableOperators.AND, filter2);

<static> dateFilter(propertyName, operation, value)

Generates a property filter condition string for a 'datetime' value.

Parameters:
Name Type Description
propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.
See Constants.TableConstants.QueryComparisons for a list of allowed operations.

value string | date

A 'datetime' containing the value to compare with the property.

Source:
Returns:

A string containing the formatted filter condition.

Type
string
Example
var query = TableQuery.dateFilter('DateTimeField', QueryComparisons.EQUAL, new Date(Date.UTC(2001, 1, 3, 4, 5, 6)));

<static> doubleFilter(propertyName, operation, value)

Generates a property filter condition string for a 'double' value.

Parameters:
Name Type Description
propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.
See Constants.TableConstants.QueryComparisons for a list of allowed operations.

value string | double

A 'double' containing the value to compare with the property.

Source:
Returns:

A string containing the formatted filter condition.

Type
string
Example
var query = TableQuery.doubleFilter('DoubleField', QueryComparisons.EQUAL, 123.45);

<static> guidFilter(propertyName, operation, value)

Generates a property filter condition string for a 'guid' value.

Parameters:
Name Type Description
propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.
See Constants.TableConstants.QueryComparisons for a list of allowed operations.

value string | guid

A 'guid' containing the value to compare with the property.

Source:
Returns:

A string containing the formatted filter condition.

Type
string
Example
var query = TableQuery.guidFilter('GuidField', QueryComparisons.EQUAL, guid.v1());

<static> int32Filter(propertyName, operation, value)

Generates a property filter condition string for an 'int' value.

Parameters:
Name Type Description
propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.
See Constants.TableConstants.QueryComparisons for a list of allowed operations.

value string | int

An 'int' containing the value to compare with the property.

Source:
Returns:

A string containing the formatted filter condition.

Type
string
Example
var query = TableQuery.int32Filter('IntField', QueryComparisons.EQUAL, 5);

<static> int64Filter(propertyName, operation, value)

Generates a property filter condition string for a 'int64' value.

Parameters:
Name Type Description
propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.
See Constants.TableConstants.QueryComparisons for a list of allowed operations.

value string | int64

An 'int64' containing the value to compare with the property.

Source:
Returns:

A string containing the formatted filter condition.

Type
string
Example
var query = TableQuery.int64Filter('Int64Field', QueryComparisons.EQUAL, 123);

<static> stringFilter(propertyName, operation, value)

Generates a property filter condition string.

Parameters:
Name Type Description
propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.
See Constants.TableConstants.QueryComparisons for a list of allowed operations.

value string

A 'string' containing the value to compare with the property.

Source:
Returns:

A string containing the formatted filter condition.

Type
string
Example
var query = TableQuery.stringFilter('StringField', QueryComparisons.EQUAL, 'name');

and(condition, arguments)

Specifies an AND where condition.

Parameters:
Name Type Description
condition string

The condition string.

arguments array

Any number of arguments to be replaced in the condition by the question mark (?).

Source:
Returns:

A table query object with the and clause.

Type
TableQuery
Example
var tableQuery = new TableQuery()
                     .where('Name == ? or Name <= ?', 'Person1', 'Person2');
                     .and('Age >= ?', 18);

or(condition, arguments)

Specifies an OR where condition.

Parameters:
Name Type Description
condition string

The condition.

arguments array

Any number of arguments to be replaced in the condition by the question mark (?).

Source:
Returns:

A table query object with the or clause.

Type
TableQuery
Example
var tableQuery = new TableQuery()
                     .where('Name == ? or Name <= ?', 'Person1', 'Person2');
                     .or('Age >= ?', 18);

select(fields)

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

Parameters:
Name Type Description
fields array

The fields to be selected.

Source:
Returns:

A table query object with the select clause.

Type
TableQuery
Example
var tableQuery = new TableQuery().select('field1', 'field2');

top(top)

Specifies the top clause.

Parameters:
Name Type Description
top int

The number of items to fetch.

Source:
Returns:

A table query object with the top clause.

Type
TableQuery
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.

Source:
Returns:

JSON object representing the query string arguments for the query.

Type
object

where(condition, value)

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.

Parameters:
Name Type Description
condition string

The condition string.

value string | array

Value(s) to insert in question mark (?) parameters.

Source:
Returns:

A table query object with the where clause.

Type
TableQuery
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
  }
});