Tracker Query Expression Syntax

In order to work effectively with the Query Expression Editor it is important to have a working knowledge of TADB structure and Basic Tracker and vocabulary.

Rules for building Query expressions include:

Syntax conventions used for building queries.

Methods in the expression language.

Simple non-terminals.

Complex non-terminals.

Named expressions.

Syntax conventions used for building queries

The syntax conventions use different font attributes for different components of the syntax.

Syntax

Applied to

Definitions

Italic

Non-terminals.

Placeholders in the syntax and are defined elsewhere in this syntax summary.

Bold

Terminals

Literal reserved words and symbols that must be entered as shown.

Characters are always case sensitive, except for NULL, which can be any possible case combination.

opt

Optional

Non-terminals followed by opt are always optional.

Example

{ expression opt }

Indicates an optional expression enclosed in curly braces.

Default typeface

Terminal characters

Characters be used as terminals in expressions.

Note: Alternative definitions are listed on separate lines, except when prefaced with the words one of.

Methods in the expression language

The three methods that use the expression language are:

Method

Definition

GetValues(ItemID,AttributeList)

Retrieve a set of values from a particular item's attributes.

ListItems(ItemType,Expression)

Find out if a particular item does or does not meet a set of criteria.

TestItem(ItemID,Expression)

Find all the items that do match a set of criteria.

Start Symbols

The basic building blocks that will make an expression valid are the start symbols, attribute-list and expression.

Non-terminal

Definition

(Start Symbols)

 

attribute-list

list-attribute

attribute-list ; list-attribute

Note: A complete attribute-list symbol must be passed to GetValues.

expression

term

! opt ( expression )

expression & expression

expression | expression

type-id { expression }

Note: A complete expression symbol must be passed to TestItem or ListItems.

Simple non-terminals

Simple non-terminals can be combined to form more complex non-terminals.

Non-terminal

Definition

Attribute-id

Identifier

Digit

One of

0 1 2 3 45 6 7 8 9

Group-id

Identifier

Length

Number

Letter

One of

_ a b c d e f g h i j k l m
n o p q r s t u v w x y z
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z

Named-expression-name

Identifier

Number

Digit, e.g. 5

Number digit, e.g. 25

Relational

One of

= < > <=  >= =l =r

Space

A single blank space character

Start-pos

Number

Text

Depends on the:

Operator that precedes the text and

Data type of the attribute being compared.

Will elicit one of the following results.

The text will be converted to the correct type automatically.

When either of the following operators are used:

=l

=r

the target attribute will be converted to character form before comparison.

If a type conversion cannot take place, an error condition will result and the query will not execute.

 

Timestamp literals can take one of two forms.

 

Absolute time stamps

‘yyyy-mo-dd[ hh:mi:ss]'.

 

 

 yyyy

4 digit year

 

 

 mo

2 digit month

 

 

 dd

2 digit date

 

 

 hh

hours

 

 

 mi

minutes

 

 

 ss

seconds

 

Relative time stamps

‘M:Q’.

 

 

 M

Measurement unit, which is one of the following:

 

 

 

yy

years

 

 

 

q

quarters

 

 

 

m

months

 

 

 

d

days

 

 

 

ww

weeks

 

 

 

h

hours

 

 

 

n

minutes

 

 

 

s

seconds

 

 

 

ms

milliseconds

 

 

 Q

An integer quantity of time from the current time in specified measurement units.

Negative numbers are used to represent previous time stamps.

Type-id

Identifier

Value

Either:

‘ text ‘

null

min()

max()

minmax

.min( identifier )

.max( identifier )

Complex non-terminals

Complex definitions usually have more than one rule.

Non-terminals

Definition

attribute

group-id . attribute-id start-pos opt length opt

identifier

letter

digit

identifier letter

identifier digit

identifier space identifier

list-attribute

attribute

group-id (sub-expression) minmaxopt.attribute-id start-posopt lengthopt

type-id { list-attribute }

sub-attribute

attribute-id start-pos opt length opt

sub-expression

sub-term

sub-expression & sub-expression

sub-expression | sub-expression

sub-term

! opt attribute Relational values

! opt sub-attribute Relational values

term

! opt attribute Relational values

! opt group-id (sub-expression ) minmaxopt

values

value

values, value

Named expressions

A named expression may be a single symbol or multiple symbols and may not contain a text symbol except in the context of completing a value symbol.  

The syntax for using a named expression is:

$ named-expression-symbol $

A named expression can be inserted anywhere except between characters.

More information

About the Query engine.