# Create Simple Decision Tree

## How to create a simple decision tree

Let's advance one step at a time.

### 1. Log in

Becoming a superhero is a fairly straightforward process. After entering our [<mark style="color:purple;">login page</mark>](https://app.decisionrules.io/auth/login), you will be able to pass your credentials and log in.

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FdM0GgSnqnfDYOqa6uHHE%2Flogin%202025.png?alt=media&#x26;token=c25cd6db-7dfe-4065-93c5-d34a7b45dd35" alt="" width="375"><figcaption></figcaption></figure>

There are multiple options for user login. If you do not have an account yet, you can [<mark style="color:purple;">create one</mark>](https://app.decisionrules.io/auth/register?type=true-registration). After logging in to the application, the folder structure of your Rules List will be displayed.

### 2. Create a New Decision Tree

To display the rules creation list, click the <mark style="background-color:purple;">**+ Create**</mark> button on the search bar. Select your rule and you will be prompted to provide a nam&#x65;**.** For this example, we will create a tree for procrastination, select a name for your rule as you wish and press "Confirm". The new rule will be created and its design interface will be displayed. We will continue in the Rule Setting menu.

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FJMKVe0sMc5rnUZcC9Dwh%2FCreation%20of%20trees%20Academy%20Dec%202025.gif?alt=media&#x26;token=3cf1212b-e093-4ce3-a380-0104cf62c0f9" alt=""><figcaption></figcaption></figure>

### 4. Create the input and output model

We will now create the input and output model which is used to set conditions and results. There are two ways to create these models:

#### Using the simple editor

Let's start with the input model. First, you can switch from "Designer" to "Model" at the centre of the top bar. Delete the default attribute "input" by clicking the trash can icon next to the name. Then, add your own attributes: <mark style="color:purple;background-color:purple;">**inputAttribute**</mark>. Create a root for each new of them by clicking the **+Add Root** button.

Now, you can continue with the output model. It will be set similarly. As root attribute, add <mark style="color:green;background-color:green;">**output**</mark> . Then, you can add a child attribute to the this root. Click the + icon within the 'output' field. Rename the New Attribute to  <mark style="color:green;background-color:green;">**mission**</mark> .

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FjaLRiTxaSsRTV4UA1Tvm%2FInput%20and%20Output.png?alt=media&#x26;token=ceeabd5a-2d36-4db8-9d5a-d9cf6b729dfb" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
After creating an input or output model, we must always confirm the changes with the <mark style="background-color:orange;">save</mark> button.
{% endhint %}

{% hint style="info" %}
More information on the simple editor is provided [<mark style="color:purple;">here</mark>](https://docs.decisionrules.io/doc/decision-tables/input-and-output/simple-editor).
{% endhint %}

### 3. Create First If Block

Click on "Create First Condition".

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FBR32wtMDdBgDOadI5pzv%2FCreate%20first%20condition.png?alt=media&#x26;token=e4967fc7-4a09-466a-bce4-2d941e850d15" alt="" width="375"><figcaption></figcaption></figure>

### 4. Specify Condition Inside If Block

1\. Click on the first "Add Condition" button inside the If Block.&#x20;

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FQF57hanac9AYrRpmg3Tn%2FIf%20block.png?alt=media&#x26;token=b68fd582-cc69-4ac0-91aa-61adbcfc0ae1" alt="" width="343"><figcaption></figcaption></figure>

2\. Dropdown will be shown. Click on "Logic AND".

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2F2i8oajlZLJbNqkBHfnIz%2FAND%20or%20OR.png?alt=media&#x26;token=6144d7d6-d866-44e8-b05c-12394a1b4c8b" alt="" width="349"><figcaption></figcaption></figure>

3\. Click on the orange dropdown <mark style="color:orange;background-color:orange;">**Not set ˇ**</mark> . Here you will choose an input that later will be evaluated when solving the decision tree.

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FbNBcZphv9O87ZEMHrrzQ%2FinputAttribute.png?alt=media&#x26;token=2e191700-5c50-49fd-b763-2282d362098c" alt="" width="563"><figcaption></figcaption></figure>

4\. Now click on the empty text to the right side of the operator <mark style="color:green;background-color:green;">**=**</mark> , and edit the value.

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FfsfRdIJ8MBfaLOpuMO5D%2FinputAttribute%202.png?alt=media&#x26;token=b99d1cb0-6e0f-4e6b-8e9d-6b4ec59892fa" alt="" width="563"><figcaption></figcaption></figure>

5\. Now type in a value to which we will compare the input once solving the decision tree. Let's write "learning" for example.&#x20;

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FPkLZD9WnDwbaNvotHfxX%2Fadd%20block%20IF.png?alt=media&#x26;token=529afe44-553b-45b9-930d-86b84bc36786" alt="" width="563"><figcaption></figcaption></figure>

6\. Now click on the <mark style="background-color:purple;">**Add Block**</mark> button at the right-side of the If Block. And Select "Then" from the list.

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FCMYhqPFI6FHHD4ExynxK%2FSelection%20of%20the%20left%20side%20of%20IF.png?alt=media&#x26;token=708ee3dc-e991-4495-a691-ae02494f2e31" alt="" width="563"><figcaption></figcaption></figure>

7\. Click on "Add Result".

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FmfByPJb7cVfGLROoQpdb%2FAdd%20result.png?alt=media&#x26;token=b7e87f48-2bd1-45f6-be97-ff512e308478" alt="" width="563"><figcaption></figcaption></figure>

8\. Once again, click on the orange button saying <mark style="color:orange;background-color:orange;">**Not set ˇ**</mark> and choose the only Output you defined.

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FrFlXjvKq8UIsPGLhInOn%2Foutput.mission.png?alt=media&#x26;token=7ae7f1e2-1f4f-4d1c-bfb2-ea8cf1542dfe" alt=""><figcaption></figcaption></figure>

9\. Change the operator from function <mark style="color:green;background-color:green;">**Fn**</mark> to equal <mark style="color:green;background-color:green;">**=**</mark> . Now, click on the empty text to the right side of the operator and edit the value as with the 'if condition'.

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FsNlWJDxJ2ftRAM36n5Vb%2Fmission%20accomp.%20on%20the%20output.mission.png?alt=media&#x26;token=df74f398-3777-4d31-ba4c-55c62908417c" alt=""><figcaption></figcaption></figure>

Great, you now know how to create a simple condition :tada:.

### 5. Create Second If Block

To simplify the process, you can click on the cogwheel icon of the first If Block and select "Clone" from the dropdown list.

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FmG9415gYuKJdTWi6Fxih%2FClone%201.png?alt=media&#x26;token=7e3ef947-2d88-4e08-9f8e-58c2f2b00513" alt=""><figcaption></figcaption></figure>

This will create an exact copy of the If Block down below.

The only thing to do now is to change the values inside the newly created If block:

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FikxydWr6wqY45UBw4JG2%2FCloned%202.png?alt=media&#x26;token=fe3da294-70a9-4d5a-abda-873c9bb861c7" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
These two If blocks are very similar to the If and Else-If behavior, if you are familiar with programming concepts.
{% endhint %}

### 6. Create Else Block

Finally we create an Else Block. The Else Block will be executed whenever none of the above If Blocks evaluate to true. In our case, if the Input is anything else than the values 'learning' or 'procrastinating'.

Now click on the <mark style="background-color:purple;">**Add Block**</mark> button under the If Block and add another "Else" block.

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FhBrNqBCwDPmXZ79i8zV6%2FElse%201.png?alt=media&#x26;token=45dbcfbb-1fbc-4e99-9944-3edef6b79198" alt=""><figcaption></figcaption></figure>

Now, inside the last Else Block simply press the <mark style="background-color:purple;">**Add Block**</mark> button and add a Then Block. Fill it out with whatever value you like. Remember to change the operator from function to equal.&#x20;

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FDPceOwoWNeo0f7SHqgjb%2FChange%20for%20equals.png?alt=media&#x26;token=6770d7f1-132b-46e0-9853-0a76679ede5d" alt=""><figcaption></figcaption></figure>

### 7. Test It!

Simply click on the <mark style="background-color:green;">**Test bench**</mark> in the bottom bar.

Type "learning" in the Input Property and click on <mark style="background-color:green;">**Run**</mark> .

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FIFE6QfkqHK0ti0QHgJpg%2FTest%20learning.png?alt=media&#x26;token=888040fe-0673-495b-8c85-b462767a560c" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
The first block was evaluated as expected.
{% endhint %}

Inputting the word "procrastinating" will return "mission failed".

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FgStINMQs35NhmmM6VpKz%2FTest%20procrastinating.png?alt=media&#x26;token=b1803bfe-b28b-4d05-8323-e79e988eaff8" alt=""><figcaption></figcaption></figure>

Finally, you can try the Debug toggle and see true valuations in green, false valuations in red, and no color if the block was not evaluated.

<figure><img src="https://1428908423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2kePaAlhzmPFZTjuxdCY%2Fuploads%2FEplvWpojbjD26WTXoanY%2FDebug.png?alt=media&#x26;token=26bf8253-c672-4aa8-ab2a-9ccb02f148f8" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
More information can be found [<mark style="color:purple;">here</mark>](https://docs.decisionrules.io/doc/decision-trees/decision-tree-designer).
{% 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://academy.decisionrules.io/rule-types/decision-trees/create-simple-decision-tree.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.
