# On-load scripting

Inforiver’s on-load scripting feature enables you to list a set of actions to be performed on loading the visual. You can display messages, set the layout, hide columns, or apply filters as the visual is loaded. The scripts will be executed when you open the report, switch to the tab containing the visual, or refresh the visual. &#x20;

Inforiver offers an array of built-in functions that you can use to set up scripts effortlessly. [Learn more about scripting functions.](/premium-table/formula-syntax/scripting-functions.md)

<figure><img src="/files/Of2NGiO40UjKWvw6uaay" alt=""><figcaption><p>On load scripts</p></figcaption></figure>

Notice how all the scripts have been executed when the visual is loaded.

{% hint style="info" %}
To see the scripts in action, click the Run now button
{% endhint %}

<figure><img src="/files/P9XAEmMFCIRzQuY2PHg2" alt=""><figcaption><p>Executing on-load scripts</p></figcaption></figure>

Let's look at some applications of on-load scripts.

#### 1. Displaying messages

You can display custom text as a toast message notification. The supported types include alerts, information, warnings, and success messages among others. [Learn more about the DISPLAYTOAST function.](/premium-table/formula-syntax/scripting-functions/displaytoast.md)

<div><figure><img src="/files/Fa38bRJrrRS0SjiD2woz" alt=""><figcaption><p>Alert message</p></figcaption></figure> <figure><img src="/files/UohVs3rgGqwq7imm3eZE" alt=""><figcaption><p>Info message</p></figcaption></figure> <figure><img src="/files/4IN2zOg8y50U7R9MvJT1" alt=""><figcaption><p>Warning message</p></figcaption></figure></div>

#### 2. Setting the layout

You can set a particular theme or expand hierarchical data to a specific level. [Learn more about the LAYOUT function](/premium-table/formula-syntax/scripting-functions/layout.md).

<div><figure><img src="/files/klzUlm0LXlfLVlcyIYBr" alt=""><figcaption><p>Setting the theme and layout</p></figcaption></figure> <figure><img src="/files/V9J5kTgvX1XvGRxGOXEk" alt=""><figcaption><p>Navigating to a particular hierarchy level</p></figcaption></figure></div>

#### 3. Filtering periodic data

You can filter the data to show only a specific time period, for instance, the last 4 months or the last 2 years. [Learn more about filtering time series data](/premium-table/formula-syntax/scripting-functions/showbetweenperiod.md).

<figure><img src="/files/vROp2TjBQFyOQr5TlBQj" alt=""><figcaption><p>Displaying next 4 months when current month is May</p></figcaption></figure>


---

# 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.inforiver.com/premium-table/display-settings/on-load-scripting.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.
