# Script Development

Scripting is what significantly enhances the functionality of aqua reports. With scripting you can enhance the report not only by relying on the data within aqua but by being able to add data by reading databases or files.  You also have the option to save a copy of the report in a certain network drive or to choose not to print certain elements on every event band iteration.

To execute a script on a certain event, you need to add a script function for the event of the element. You can do this by linking a script method to the “Behaviour/Scripts” property. All events that the element selected throws are listed within this property. These can vary for different types of elements.&#x20;

&#x20;

<figure><img src="http://aquawiki.andagon.com/pictures/drex_script_development_2_custom.png" alt=""><figcaption></figcaption></figure>

To change to the scripts view, click on the Scripts button at the bottom left of the report designer.&#x20;

<figure><img src="http://aquawiki.andagon.com/pictures/drex_script_development_2_custom_2.png" alt=""><figcaption></figcaption></figure>

Here, you can add some functionality to your report. For example, if you only want to print a label every second time, you can add the following code: &#x20;

<figure><img src="http://aquawiki.andagon.com/pictures/drex_script_development_2_custom_3.png" alt=""><figcaption></figcaption></figure>

During script development, you can make use of the entire .NET library, and you reference all elements and their respective properties within the report.&#x20;

### **Example: Apply different colour to areas** <a href="#example__apply_different_color_to_areas" id="example__apply_different_color_to_areas"></a>

The appearance can be modified with the event “OnPrintPage”

```csharp
private void OnPrintOnPage(object sender, DevExpress.XtraReports.UI.PrintOnPageEventArgs e)
{
    string t = ((XRLabel)sender).Text; // Get the label's text.
    t = t.Substring(0, t.Length - 1); // Remove the last character from the text 
    int value = int.Parse(t); // Parse the text into an integer.

    if (value < 20)
    {
        ((XRLabel)sender).ForeColor = Color.FromArgb(255, 0, 0); // Set the label's forecolor to red if the value is less than 20.
    }
    else if (value > 80)
    {
        ((XRLabel)sender).ForeColor = Color.FromArgb(0, 110, 0); // Set the label's forecolor to green if the value is greater than 80.
    }
    else
    {
        ((XRLabel)sender).ForeColor = Color.FromArgb(255, 165, 0); // Set the label's forecolor to orange if the value is between 20 and 80.
    }
}
```

The appearance can also be modified using format rules.


---

# 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.aqua-cloud.io/documentation/desktop-client/reporting/script-development.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.
