Advanced Searching

Introduction

The Angus Australia application provides a powerful search system that uses a custom query language called TQL, or Translatable Query Language.TQL is a human-readable language. In other words, you should be able to understand a TQL query just by reading it.

TQL provides significant advantages over the traditional, hard-coded search forms that you may be used to. These advantages include:

  • More flexibility in the fields, operators and values that are available for searching.
  • Immediate query validation, even as you are entering the query.
  • Suggestions for what fields, operators and values to use in your query.
  • An advanced text mode for more experienced users, or a basic query building mode for less experienced users.
  • Greater expressiveness in text mode, allowing you to combine conditions with the and and or keywords, or nest conditions using parenthesise (the ( and ) characters).

Reference

Herd Animal Searching

Herd animal searching is restricted to the herd for which you are the principal member, or the herds with which you have been affiliated.

Field Operator Example Values
id=
is
contains
begins with
ends with
name=
is
contains
begins with
ends with
key=
is
tattoo=
is
sex=
is
FEMALE
MALE
STEER
inventory season=
is
AUTUMN
SPRING
birth year>=
>
<=
<
is after
is before
is on or after
is on or before
=
is
animal is active
register=
is
ACR
AHS
APR
HBR
MBR
PTR
RAR
RECIP
UNREG
recipient dam id=
is
sire id=
is
contains
begins with
ends with
dam id=
is
contains
begins with
ends with
export id=
is
TQL_HELP_UserLayoutDefinition
Field Operator Example Values
id=
is
first name=
is
contains
begins with
ends with
last name=
is
contains
begins with
ends with
username=
is
mobile=
is
email=
is
user is online
user is offline
useris principal of account
is affiliated with account

Notification Searching

Field Operator Example Values
id=
is
type!=
is not
=
is
SMS
WEB
EMAIL
notification is unread
notification is read
to=
is
create date>=
>
<=
<
is after
is before
is on or after
is on or before
=
is
read date>=
>
<=
<
is after
is before
is on or after
is on or before
=
is
delivery date>=
>
<=
<
is after
is before
is on or after
is on or before
=
is
subject=
is
contains
begins with
ends with
content=
is
contains
begins with
ends with

How It Works

Boolean Expressions

TQL is built from truth statements or "boolean expressions". If the boolean expression is true for a particular object (such as an animal or a member), the object will be returned as a part of the results. There are three types of boolean expressions: comparisons, logicals and groupings.

Comparisons

Basic Form

The most basic boolean expression is a comparison. A comparison is comprised of three elements:

  • The field of the object. For example, the animals' name.
    Fields can be multiple words, for example, birth date.
  • The value, which is to be compared to the field. For example, "daisy".
    A value is a single words containing only letters or numbers. If you want to specify other characters in the value, surround it with single or double quotation marks, for example 'Home Simpson' or "Steve Jobs". A quoted value cannot contain the quotation mark that surrounds the value unless it is escape with a backslash (e.g., 'Mr\'s Doughtfire'). A backslash can also be escaped with a backslash (e.g., "\\").
  • The operator, which determines how the field should be matched to the value.
    Operators can be punctuation marks (e.g., = for equality or != for inequality) or alphabetical (e.g., contains). Alphabetical operators can be multiple words, for example, begins with.

The elements of a comparison must be in the order <field> <operator> <value> as in the following example.

name begins with da
The above comparison would be true for an animal called "Daisy" but false for an animal called "Mr Darcy". In this case "Daisy" would appear in the results while "Mr Darcy" would not.

Operator-less Fields

Some fields do not have operators and do not accept values. For example animal is active may appear to have a field, operator and value (animal being the field, is being the operator and active being the value), but in actual fact this is treated internally as a single field comprised of multiple words.

Field and Operator Availability

Different fields and operators are available depending on the type of object for which you're searching. For example, when searching for members, the operator-less field animal is active does not apply and therefore is invalid.

Logicals

A logical is a boolean expression comprised of multiple sub-expressions, joined by either the and or or keywords.

Logicals allow you to form more complex queries by chaining expressions together. In the example below, the query results will only contain female animals with "daisy" in their name.

name contains daisy and sex is female

Groupings

A grouping is a boolean expression that evaluates in a particular order. Group expressions are surrounding by parenthesis (the ( and ) characters).

In the example below, the results will include all females and steers that are Australian-born animals.

(sex is female or sex is steer) and animal type is australian