# Load script

## Existing data model

To ensure that the storing of data works smooth it is good practice to wrap your existing data model load into the following if statement.

```sql
If not IsPartialReload() then
```

\<Existing data model load script>

```bash
end if
```

Just insert it at the very beginning of your data load and in the end. You can have as many script sections included between the `then` and `end if` statements as you like.

{% code title="Example:" %}

```sql
If not IsPartialReload() then
FEATURES:
LOAD
    CASEID,
    COUNTRY
FROM [lib://Komment/Call_Center.xlsx]
(ooxml, embedded labels, table is Sheet1);

End if
```

{% endcode %}

{% hint style="info" %}
If you use the autoCalender script you need to have this sit **outside** the "if not ispartialreload() section". e.g. starting after the "End if" in line 9 in the example above.
{% endhint %}

## Adding Komment fields

Before you start configuring Komment in the User Interface you need to define if any new fields are to be used as an editable field.

Still in the load script:

1. Find an existing data table for which you want your Komment fields to be related to.
2. Add new lines for each of these fields using the following notation `null() as Comment`
3. Reload the application after you've added the needed fields.

```sql
CASES:
LOAD
    CASEID,
    Country,
    Severity,
    //Newly defined input fields
    Null() as Status,
    Null() as Action,
    Null() as Date
FROM [lib://Komment/Call_Center.xlsx]
(ooxml, embedded labels, table is Sheet1);
```

{% hint style="info" %}
If you have all the fields you need in your current data e.g. if you want to be able to edit the Severity field and this is already in your data - just load it as you'd normally would.
{% endhint %}

{% hint style="info" %}
You can also set a default value instead of Null(). E.g. for a status field you could insert 'Pending' as Status
{% 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://docs.extendbi.com/komment3/getting-started/load-script.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.
