# CSV Connection

{% hint style="info" %}
Check out the given walk-through on how to create the CSV data connection and associated it with a charting component.&#x20;
{% endhint %}

<figure><img src="/files/xtwYRbRFLpLUJPfFWUFE" alt=""><figcaption></figcaption></figure>

Click the ***Data source*** icon provided on the right side of the canvas, and view the database connectivity options.

* Click the ***Data Connectors*** icon  to display all the available data connector types.
* Click the ***Create New Connection*** icon  provided next to the ***CSV*** option.
* A new connection gets added under the CSV connection type.
* Click the connection to display the connection-specific details.

![Creating a New Connection](/files/WQ0tkxpVN3Zm77JYohcT)

* Configure the following information:
  * **Name:** Name the connection.
  * **Browse:** Click the ***Browse*** icon  to browse a CSV file.
  * **Load at Start:** Enable this option to get the updated data from the data source before loading it into charts.
* The ***Field Set*** tab displays all the fields after establishing the data connection.   &#x20;

![Configuring a Data connection](/files/h4C9efDK2wmQYGs7q7Ik)

### Condition

* Select the ***Condition*** tab.
* Provide a condition to be applied as a filter on the selected data by putting a checkmark in the given box.&#x20;
  * **E.g.,**  As displayed in the following image, specific date has been provided under the Conditions column for the Timeline so, data for the given date will be taken.   &#x20;

![](/files/bLAsM9S3z5BjSrsIq0er)

### Calculated Field

The users can add a calculated field by using this tab.

* Navigate to the Data Connectors page.
* Create a connection by selecting a specific Data Connector type.
* Connect to the desired data source to access the available fields.
* Click the ***Calculated Fields*** tab.
* The ***Calculated Field Editor*** dialog box opens.
  * **Name:** Provide a name for the calculated field
  * **Script Editor**: Use the Script Editor space to insert the desired calculation formula using the rule given below.
* Click the ***Create*** option to create the calculated field.

&#x20;    ![](/files/6w9u5Xr2C2YuvFtiKzDY)

{% hint style="info" %} <mark style="color:green;">Please Note:</mark>&#x20;

* Enclose field names in square brackets: \[total\_sales]/\[number\_of\_items]

* Enclose global variable in curly braces: {bar1.profit}\*2+\[profit\_jan]
  {% endhint %}

* The newly created calculated field gets added under the ***Calculated Fields*** tab.

&#x20;  &#x20;

![](/files/q5UuSxbed3diUpneBJjV)

### Script on Load for a Data Connection

The users can apply their modifications or preferences at the connection level using the Scripting window to get the modified data.             &#x20;

* Navigate to the Data Connectors page.
* Select a Data Connector type.
* Create a new Connection and configure it.
* Select the ***Script on Load***  icon provided next to the connection.  &#x20;

![Accessing the Script on Load icon under the Data Connectors page](/files/KWF8MLkh3GGHhYYP74o8)

* The ***Script*** tab appears to trigger a script to produce some action on the data connection.

![The Script tab for connection](/files/zvKZ3cPJHDAa1HRbFJak)

* The user can also use a script for the Dashboard, which can be accessed via the **Components** tab.

![The Script window for the Dashboard components](/files/dk5fDztHYg4GomBKBvyM)

* The user can search the script for the Dashboard, which can be accessed via the ***Script*** tab.

![The Script window for the Dashboard ](/files/gSd4DRnOKSLzZHdgy9I2)

<mark style="color:green;">Please</mark> <mark style="color:green;">Note:</mark>

* Click the ***Help*** icon from the Script on the Load page.   &#x20;

![Accessing the Help icon ](/files/l2Mh4oQCFzH3X8MnrChI)

* The ***Scripting Help*** tab opens with some predefined scripts.                              &#x20;

![Scripting Help tab with pre-defined scripts](/files/4EKMKtvfBL1Jdm6pkNHK)

* Click the ***Advanced Scripting*** option to display the chart-wise advanced scripts.    &#x20;

![The Advanced Scripting tab displaying the chart-wise advanced scripts](/files/5rzW6Ee4YtInOE2FPnMW)

&#x20;              &#x20;


---

# 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.bdb.ai/bdb-documentation/data-visualization/governed-dashboards/connecting-to-a-data-source/establishing-a-data-connection/csv-connection.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.
