> For the complete documentation index, see [llms.txt](https://docs.ninox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ninox.com/ninox-scripting/automate-your-workflows/explore-core-scripting-elements/logic-editor-features.md).

# Logic editor features

The logic editor helps you write cleaner scripts with less trial and error. It supports you while typing, helps you explore available fields and tables, and adds AI support when you want a faster start.

## **Use the editor sidebar** <a href="#use-the-editor-sidebar" id="use-the-editor-sidebar"></a>

The left side of the editor gives you quick access to three tabs:

* **AI assistant** helps you create or explore script logic.
* **Fields** shows the fields of the current table.
* **Tables** shows tables and their fields.

Use the search box in **Fields** and **Tables** to find names faster.

### **Use the Fields and Tables tabs**

The **Fields** and **Tables** tabs help you insert field names without typing them manually.\
Use **Fields** to work with fields from the current table. Use **Tables** to browse other tables and their fields.\
When you hover over a field, Ninox shows extra details such as the field label and field type.\
When you click a field, Ninox inserts that field into the script immediately. It inserts the field at the current cursor position, or replaces the current selection.

## **Use AI to write or explore scripts** <a href="#use-ai-to-write-or-explore-scripts" id="use-ai-to-write-or-explore-scripts"></a>

The AI assistant can generate Ninox script from a plain-language prompt. Use it when you know the result you want, but not the exact syntax yet.

{% stepper %}
{% step %}

### Describe the result

Open the **AI assistant** tab and describe what the script should do in plain language.
{% endstep %}

{% step %}

### Refine the prompt

Use **Improve message** if you want help making the request more specific before you send it.
{% endstep %}

{% step %}

### Review the proposal

Check the generated script and the short explanation of what it does.
{% endstep %}

{% step %}

### Accept or reject the script

Click **Accept** to keep the proposal, or **Reject** to discard it.
{% endstep %}

{% step %}

### Confirm the result

Click **Confirm** to save the script in the editor.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
Be specific in your prompt. Mention the table, fields, and expected result when possible.
{% endhint %}

### **Use AI again after saving**

When you reopen a script that was created or edited with AI, the assistant stays available.

You can then use options such as:

* **Explain this code** to get a plain-language summary of the current script
* **Suggest ideas** to explore follow-up changes or next steps

These options help when you want to understand an existing script before you change it.

## **How the editor helps you write logic** <a href="#how-the-editor-helps-you-write-logic" id="how-the-editor-helps-you-write-logic"></a>

These features matter most when you write or edit scripts yourself without the **AI assistant**. If you generate a script with AI, the assistant already handles much of the structure and syntax for you.

The editor still handles several small tasks for you, so you can focus on the logic itself:

* **Line numbers** stay visible by default. They help you scan long scripts and jump to the right place faster.
* **Automatic indentation** keeps related lines grouped clearly. This matters most in `if`, `for`, and other multi-line script structures.
* **Code formatting** gives your script a more consistent layout. Spacing and line breaks become easier to read after saving.
* **Automatic suggestions** suggest matching functions, fields, and other script elements while you type. Press `Enter` to accept the first result, or use the arrow keys to choose another one.
* **Syntax highlighting** helps you distinguish different parts of your script, such as keywords, field names, variables, and text values.
* **Matching parentheses** helps you keep parentheses balanced. When you type `(`, Ninox adds `)` automatically. When your cursor is next to a parenthesis, Ninox highlights the matching one. This makes it easier to see where an expression starts and ends.

{% hint style="info" %}
If a script looks uneven, save it and reopen it to check the updated formatting.
{% endhint %}

### **What Ninox adjusts automatically**

When you save, Ninox cleans up parts of your logic automatically. This helps you keep scripts consistent and easier to read.

#### **Parentheses**

Ninox removes unnecessary parentheses when they do not change the result of your expression.

```ninox
1 + (2 * 3)
```

This is saved as:

```ninox
1 + 2 * 3
```

The result stays the same because multiplication is evaluated before addition.

#### **Whitespace**

Ninox removes extra spaces and keeps the spacing that improves readability.

```ninox
text ( year ( today ( ) ) )
```

This is saved as:

```ninox
text(year(today()))
```

Ninox may also add spaces around operators or keywords where that makes your logic easier to scan.

#### **Field names after renaming**

You can rename a field without rewriting your existing logic. Ninox keeps the internal field reference, so your script still points to the same field.

#### **Indentation**

Ninox formats indentation automatically when you save. This helps you read nested logic more easily, especially in `if`, `for`, and similar blocks.

## **Find your place and fix issues faster** <a href="#find-your-place-and-fix-issues-faster" id="find-your-place-and-fix-issues-faster"></a>

The editor also helps you stay oriented and troubleshoot faster. \
Error and warning marks appear while you type. Problem lines are marked in the line number area, and the affected code is underlined. Hover over the red mark at the start of a line to see the message. You also see the message in red below the editor.

There is one important detail about errors:

* Syntax errors usually stop the editor from checking the rest of your script. Because of that, you often see only the first syntax issue until you fix it.
* Missing or incorrect references can be marked separately when the rest of your script is still clear enough for the editor to continue checking it.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.ninox.com/ninox-scripting/automate-your-workflows/explore-core-scripting-elements/logic-editor-features.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.
