# Defining Data

## Overview

In Kognitos, **defining data** refers to naming a specific piece of information, allowing it to be stored, referenced, updated, and passed between steps within an automation.

Every **data element** (also referred to as a **fact**) consists of two parts:

1. A [**name**](#data-names) that identifies and labels the data.
2. A [**value**](#data-values), which represents the information itself. Values can be singular or plural.

### Defining Singular Data

To define a **singular** data element, use **"is"**:

```
<name> is <value>
```

### Defining Plural Data

To define a **plural** data element, use **"are"**:

```
<name(s)> are <value(s)>
```

### Examples

1. In this example, **the customer** is the data name. It is assigned the singular value **"John Smith"**:

```
the customer is "John Smith"
```

2. Here, **the items** is the plural data name. It is assigned the plural value of **the documents**.

```
the items are the documents
```

3. In this example, **the fruits** is the plural data name. It is assigned a list *(plural)* of fruit values:

```
the fruits are the apple, the banana, the orange
```

{% hint style="warning" %}
Make sure singular names pair with singular values, and plural names pair with plural values! For example, you wouldn’t write **“the fruits is the orange”**. Instead, you would write: **“the fruits are the oranges”**.
{% endhint %}

## Data Names

Data names define how information is labeled and referenced. The following rules apply:

#### 1. Begin with "the"

Data names must be prefaced with **the**. For example:

```
the email
```

```
the phone number
```

```
the primary username
```

#### 2. Names can be Simple or Descriptive

Data names can be simple or descriptive. Adjectives can be used in descriptive names to provide additional clarity or context. For example:

**Simple Name**

```
the message
```

**Descriptive Name**

```
the very special user greeting message
```

## Data Values

Data values can be singular or plural. Possible data types include **numbers**, **text**, **dates**, **lists,** or **references to other data** elements.

### 1. Numbers

**Numeric** values can be assigned to data such as age, balance, or rates. For example:

```undefined
the age is 21
```

```undefined
the bank balance is $120.20
```

```undefined
the interest rates are 5.67, 6.25
```

### 2. Text

**Text** values can be words, sentences, or phrases. They can include any characters—letters, numbers, symbols, or spaces—as long as they are enclosed in double quotes (`""`). For example:

```undefined
the message is "Welcome to Kognitos!"
```

```undefined
the username is "i-like-to-automate-123"
```

```
the announcement is "We're so glad you're here. Let's build something great together."
```

### 3. Dates

A **date** value represents a specific calendar day, such as a due date, birthday, or event date. Be sure to enclose date values in double quotes (`""`). For example:

```undefined
the due date is "2024-11-05"
```

```
the project start date is "January 1, 2024"
```

```
the birthday is "March 22, 1990"
```

### 4. Lists

To define a **list**, separate the values by commas. For example:

```
the test scores are 95, 86, 100, 77, 65 and 99
```

```undefined
the coupon codes are "SAVE20", "SALE2024", "HAPPYHOUR" and "JUST4U"
```

```undefined
the email addresses are "john@gmail.com", "johnny@yahoo.com" and "johnsmith@aol.com"
```

### 5. Referencing Other Data

The value of a data element can also be a **reference to another data element**. In these cases, the data value is set to another data name. For example:

```
the username is the customer email
```

```
the documents are the receipts 
```

```
the approver is the manager
```

{% hint style="warning" %}
**Note:** You can only reference another data element if it has been defined earlier in the automation.
{% endhint %}

### 6. The Above

When a data element's value is set to `the above`, Kognitos makes a **copy of the value** from the previous lines in the automation:

```
<data name> is the above
```

#### Examples

1. In this example, **the backup email** is assigned the value `john@example.com`.

```
the customer email is "john@example.com"
the backup email is the above
```

2. Here, **the invoice total** is assigned the value `150`.

```
the order total is 150
the invoice total is the above
```

3. In this example, **the file** is assigned a copy of the above file in the automation.

```
the file is the above
```

## Reassigning Data

Use the `use` keyword to reassign a data element, which **copies the reference** to the original data value:

```
use <data value> as the <data name>
```

{% hint style="warning" %}

#### Warning: Overwriting Data

Updating a referenced data element can overwrite previous data — see Example 2 for more details.
{% endhint %}

#### Examples

1. In this example, the **registration date** is reassigned the value `11-05-2024`.

```undefined
use "11-05-2024" as the registration date
```

2. In this example, **the order name** is assigned a copy of the reference to **the last name**, meaning it will point to the same value.

```undefined
use the last name as the order name
```

If the last name changes, the order name will also change, because it references the same value. When the last name changes to `Smith-Brown` (line #3), the order name also changes (line #4):

{% code lineNumbers="true" %}

```
the last name is "Smith"
use the last name as the order name
the last name is "Smith-Brown"
the order name
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kognitos.com/legacy/legacy-experience/writing-automations/automation-basics/defining-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
