# Defining Input Data Schema

### 1. Add input schema file

In the **MyInputs** folder in your solution, right-click and select **"Add (D)"** > **"Add New Item (W)..."**. Select the **InputData** item from the list of items, name it \[schema name].cs, and press the **"Add (A)"** button to add it. The example below shows the screen for adding an input schema named "SampleData".

<figure><img src="/files/eoqNml4kJtK4nrs46zND" alt="Adding Input Schema File"><figcaption><p>Adding an input schema file</p></figcaption></figure>

### 2. Define input schema and KeyMappings

Define column names and data types in the added input schema file. There is no limit to the number of columns you can define and you are free to add as many as you need. The example below defines two columns "COL\_1", "COL\_2" of type String.

You can add KeyMappings as needed to look up data through defined keys. KeyMappings can be added through the constructor of the schema file. The example code below creates a KeyMappings with "COL\_1" as the Key and another with "COL1" and "COL\_2" as the Key. KeyMappings are Dictionary structures with Int as a key, and you can access each KeyMapping through the Key of the KeyMappings. You can see how to retrieve data through KeyMappings [here](/sdmp-user-manual-eng/data-handling/retriving-data.md#key).

```csharp
using Nodez.Data;
using Nodez.Data.Interface;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace Nodez.Project.Template.MyInputs
{
    public class SampleData : IInputRow
    {
        // Define columns here (NOTICE: The column name defined here and the column name defined in the data file must match.)

        public string COL_1 { get; private set; }

        public string COL_2 { get; private set; }

        public SampleData()
        {
            // Define keys here (You can search data with the key defined here. Allow multiple keys)

            HashSet<string> key = new HashSet<string>();
            key.Add("COL_1");

            this.KeyMappings.Add(1, key);

            HashSet<string> key2 = new HashSet<string>();
            key2.Add("COL_1");
            key2.Add("COL_2");

            this.KeyMappings.Add(2, key);
        }
    }
}
```

{% hint style="warning" %}
The column names defined in the input schema file must match the column names defined in the input data file. We recommend that you also define the data type for each column defined in the input schema file to match what is defined in the input data file.
{% endhint %}


---

# 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://swonh.gitbook.io/sdmp-user-manual-eng/data-handling/loading-input-data/defining-input-data-schema.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.
