> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/database/taxonomies/terms.md).

# Terms

The terms of one taxonomy — add, edit and delete them, with order, parent, additional categories and term fields.

**Where:** Database → Taxonomies → *taxonomy name* · `/projects/<project>/db/taxonomies/<taxonomyName>/terms` (new: `…/terms/new`, edit: `…/terms/<termId>/edit`)

**Terms** are the values of a taxonomy — `Lithuania`, `Latvia` and `Estonia` in `Countries` — that records point at. Each term has a title in every project language, an order for menus and, when the taxonomy has a parent, its place in the tree.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-764a60cb155c28c12a0fa99df1213d06da9b488a%2Fterms-3.png?alt=media" alt="&#x22;Countries&#x22; Taxonomy Terms with the columns Term, Parent and Order: Lithuania Baltics 1, Latvia Baltics 2, Estonia Baltics 3; Add New Term at the top right"><figcaption><p>The terms of Countries.</p></figcaption></figure>

## Columns, search and filters

| Column | What it shows                                                                              |
| ------ | ------------------------------------------------------------------------------------------ |
| Term   | The title. Click it to edit the term.                                                      |
| Parent | The parent term (from the parent taxonomy), when the taxonomy has one.                     |
| Order  | The order number; the list is sorted by it, lowest first, and terms without one come last. |

The list has no search or filters. Reading needs `database:read` on `database:term:<taxonomy id>`; adding needs `database:create`, editing `database:update`, deleting `database:delete` — all on the same key.

## What you can do here

**Add a term** — press **Add New Term**. The form **Add New term** shows *Taxonomy - Countries* and these fields:

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-15165f4c4dafcb7d8d0cf669c027b1b91cbd4088%2Fterms-1.png?alt=media" alt="Add New term, Taxonomy - Countries: Title (in en) Lithuania, Description (in en), Order 1, Parent * with — Select a Regions —"><figcaption><p>The term form, top part.</p></figcaption></figure>

| Field                 | Required                       | What it does                                                                                                       | Example                                         |
| --------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- |
| Title (in en)         | yes                            | The term's name. With several project languages, the language tabs switch the translation you edit.                | `Lithuania`                                     |
| Description (in en)   | no                             | Translatable text.                                                                                                 | —                                               |
| Order                 | no                             | Lower numbers show first; leave empty for unordered terms.                                                         | `1`                                             |
| Parent \*             | when the taxonomy has a parent | The single parent term, from the parent taxonomy. Without one the form says *Please select a parent from Regions.* | `Baltics`                                       |
| Additional categories | no                             | Terms of the taxonomy's additional categories. A term set as Parent cannot also be Additional.                     | `Eurozone`, `Coastal`                           |
| Term fields           | —                              | Shown when the taxonomy has [term fields](/codemash/cloud/database/taxonomies/term-fields.md).                     | **Capital** `Vilnius`, **Population** `2800000` |

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-db7b0188d1132f90d36f09c25acfe763dad9b171%2Fterms-2.png?alt=media" alt="The lower part of the term form: Parent Baltics, Additional: Tags with Eurozone and Coastal ticked, Term fields with Capital Vilnius and Population 2800000, Cancel and Save"><figcaption><p>Parent, additional categories and term fields filled in.</p></figcaption></figure>

Press **Save**: Cloud goes back to the terms list and the new term is in it.

**Edit a term** — click its title. The form opens as **Editing term** with the saved values; change them and press **Save**.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-faa04fe419c3c81e6cebffb73f0ca99f70e87f84%2Fterms-4.png?alt=media" alt="Editing term, Taxonomy - Countries: Title Lithuania, Order 1, Parent Baltics; a red Delete button at the top right"><figcaption><p>Editing a term.</p></figcaption></figure>

**Child terms** — when other taxonomies use this one as their parent, a term's edit page lists its child terms below the form, with **Add New** that pre-selects this term as the parent. Here the Regions term `Baltics` lists its Countries.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-307aabeead7eeb6052222e4dd0ba35a07abaac49%2Fterms-5.png?alt=media" alt="Editing term Baltics, Taxonomy - Regions, with the section Countries below the form listing Lithuania #1 and Latvia, and an Add New link"><figcaption><p>A parent term with its child terms.</p></figcaption></figure>

**Delete a term** — open it and press **Delete** (top right), then **Delete** in *Delete Confirmation*.

Records store the term **id**, so a renamed or translated term shows correctly everywhere at once. The values of term fields are saved in the term's `meta`.

## Do it from code

```ts
const { list } = await norbix.hub.database.getDatabaseTaxonomies();
const countries = list.items.find((t) => t.taxonomyName === 'Countries');
const { id } = await norbix.hub.database.saveDatabaseTaxonomyTerm({
  taxonomyId: countries.viewId,
  document: JSON.stringify({ name: 'Finland', order: 4 }),
});
const terms = await norbix.api.database.findTerms({ taxonomyName: 'Countries' });
console.log(terms.list.items.map((t) => `${t.order} ${t.name}`));
// [ '1 Lithuania', '2 Latvia', '3 Estonia', '4 Finland' ]
```

```sh
norbix api database terms find --taxonomyName Countries
```

Unlike the Cloud form, the API does not require a parent term today. The client setup is on the [Database page](/codemash/cloud/database.md#use-it-from-code). API: [Save Database Taxonomy Term](/codemash/api-reference/database/taxonomies/save-database-taxonomy-term.md) · [Update Database Taxonomy Term](/codemash/api-reference/database/taxonomies/update-database-taxonomy-term.md) · [Delete Database Taxonomy Term](/codemash/api-reference/database/taxonomies/delete-database-taxonomy-term.md) · [Find Terms](/codemash/api-reference/database/taxonomies/find-terms.md) · [Find Merged Term Tree](/codemash/api-reference/database/taxonomies/find-merged-term-tree.md)
