# Extended Age Queries

**URL:** <https://speciforum.org/t/extended-age-queries/2233>\
**Category:** Query Building\
**Tags:** Specify-7, Members-only\
**Created:** [March 10, 2025, 5:00am UTC](https://speciforum.org/t/extended-age-queries/2233 "2025-03-10T05:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [March 10, 2025, 5:00am UTC](https://speciforum.org/t/extended-age-queries/2233/1 "2025-03-10T05:00:00Z")

</div>

> 📖 This guide explains how to use the Extended Age Query feature to filter queries based on geological ages. It includes descriptions of the query logic and key features along with a step-by-step guide on how to use it.

## Overview

The **Extended Age Query** (EAQ) feature enhances the querying capabilities for the Collection Object (CO) table within the [Query Builder](https://speciforum.org/t/query-builder-in-specify-7/289) by allowing users to filter collections based on geological ages. It is a powerful tool for researchers and curators in the geological and paleontological fields to accurately filter and analyze collection objects. By using both named periods and numerical ranges, users can improve their data queries and gain a deeper understanding of their collections.

This functionality is **only available** in the Geology, Invertebrate Paleontology, and Vertebrate Paleontology disciplines.

## Query Logic

The EAQ logic is based on start and end numbers (assuming Millions of Years Ago, MYA) derived from the Chronostratigraphy (`GeologicTimePeriod`) table.

Only nodes with **valid** `StartPeriod` and `EndPeriod` values are considered during the query process, meaning only nodes where `StartPeriod` is **greater than** `EndPeriod`.

The EAQ supports two primary methods for querying: by name and by range.

### Key Features

- **Filtering Criteria** : Only valid nodes in the Chronostratigraphy tree are used, ensuring that only relevant data is queried.
- **Range Calculation** : The EAQ uses the lowest `EndPeriod` and the highest `StartPeriod` values to define the range.
- **User Interface** : The EAQ field is integrated within the query builder, included as the field “Age” in Collection Object, allowing users to easily select and input their criteria.

## How to Use the EAQ

### Step-by-Step Workflow

1. **Create or Modify a Query** : Start by creating a new query or modifying an existing Collection Object query in the [Query Builder](https://speciforum.org/t/query-builder-in-specify-7/289).

2. **Add the EAQ Field** : Locate the ‘Age’ field in the query builder interface and add it to your query.

3. **Select Query Method** :

4. **Select Query Type** :

5. **Run the Query** : Execute the query to retrieve results based on the specified criteria.

### Query Logic

The EAQ searches the following areas based on the user’s input:

- **Relative Age** :
  - Searches the `AgeNameID` field, which is a foreign key to the `geologictimeperiod` table.
  - Uses the `startPeriod` and `endPeriod` fields linked to the selected age record.
  - **Computed Range** : `startPeriod` - `endPeriod`.

- **Absolute Age** :
  - Searches the `AbsoluteAge` and `AgeUncertainty` fields directly.
  - Computes a range using the formula:
    - **Example:**
      - `AbsoluteAge = 10 MYA`
      - `AgeUncertainty = 5 MYA`
      - **Computed Range** : `15 - 5 MYA`.

- **Paleo Context** :
  - Searches the `ChronosStratID` and `ChronosStratEndID` fields, which are foreign keys to the `geologictimeperiod` table.
  - Computes the widest range if `ChronosStratEndID` is present.
  - **Computed Range** : `startPeriod` - `endPeriod`.
