> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/governed-dashboards/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bdb.ai/governed-dashboards/connecting-to-a-data-source/establishing-a-data-connection/csv-connection.md).

# CSV Connection

Steps to develop a data connection based on the CSV file.

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

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2F3xtaFTjzHCRxJ6jCgLTT%2FCSVConnection.gif?alt=media&#x26;token=13086298-867f-40e8-92f6-221ee845dbd3" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> Click the **Data Connector** icon provided on the right side of the canvas, and view the database connectivity options.*
{% endhint %}

## Creating a New CSV Connection

* 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.

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2F7k7JckNw0BziQNQbwqHU%2Fimage.png?alt=media&#x26;token=56fd8633-fc34-4ed3-8bf4-55d560420b2c" alt=""><figcaption><p><em>Creating a New Connection</em></p></figcaption></figure>

* 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.

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2F8ryO13cSRYYs0lBkVDCH%2Fimage.png?alt=media&#x26;token=f3535f39-be77-4fa5-a430-215197cc0086" alt=""><figcaption><p><em>Configuring a Data connection</em></p></figcaption></figure>

## Condition <a href="#condition" id="condition"></a>

* 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.
  * **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.

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FXzYZinK7VgkfpFF8Uyjw%2Fimage.png?alt=media&#x26;token=07e655fc-d124-4ced-9e8e-798ef4219ed0" alt=""><figcaption></figcaption></figure>

## Calculated Fields <a href="#calculated-field" id="calculated-field"></a>

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.

![](https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FWGasLMJKVkWU0M18mv7d%2Fimage.png?alt=media\&token=e453eabe-d35b-482d-82f7-952d934a57b5)​

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

* *Enclose field names in square brackets: \[total\_sales]/\[number\_of\_items]*
* *Enclose global variable in curly braces: {bar1.profit}\*2+\[profit\_jan]*
* *The newly created calculated field gets added under the **Calculated Fields** tab.*

![](https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FJZIUA43bQtxTYmegrOUn%2Fimage.png?alt=media\&token=0d419a2a-c525-448b-b51a-f08e52e33e7a)
{% endhint %}

## Script on Load for a Data Connection <a href="#script-on-load-for-a-data-connection" id="script-on-load-for-a-data-connection"></a>

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

* 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.

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FzQ2OYwPCQpeEFWCpvF0X%2Fimage.png?alt=media&#x26;token=26ff21f0-41fe-4bc3-a184-88a98392bca2" alt=""><figcaption><p><em>Accessing the Script on Load icon under the Data Connectors page</em></p></figcaption></figure>

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

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FwYMLXG8mq8wCg9v5DXVC%2Fimage.png?alt=media&#x26;token=9e2862af-d51e-4b63-be97-00261edc7a20" alt=""><figcaption><p><em>The Script tab for connection</em></p></figcaption></figure>

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

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2F14zs5QyhVTLYhTiNGMXA%2Fimage.png?alt=media&#x26;token=48be3a6b-8991-4daf-b36b-b94a5d418321" alt=""><figcaption><p><em>The Script window for the Dashboard components</em></p></figcaption></figure>

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

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FaLFxQBlKne0DCXQC3WFX%2Fimage.png?alt=media&#x26;token=b1022328-5add-46bd-9252-ff8919b08160" alt=""><figcaption><p><em>The Script window for the Dashboard</em></p></figcaption></figure>

## Opening the Scripting Help/ Advanced Scripting&#x20;

* Click the ***Help*** icon from the ***Script on the Load page***.

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FidMuKSCpULgNHcZ7NcaL%2Fimage.png?alt=media&#x26;token=8bc56bc0-ca7e-411d-8798-48c9f318d880" alt=""><figcaption><p><em>Accessing the Help icon</em></p></figcaption></figure>

* The ***Scripting Help*** tab opens with some predefined scripts.

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FCQStoGn1AiRcE0wXpC5E%2Fimage.png?alt=media&#x26;token=d3c19780-d0ff-4e4a-b044-89e269f22578" alt=""><figcaption><p><em>Scripting Help tab with pre-defined scripts</em></p></figcaption></figure>

* Click the ***Advanced Scripting*** option to display the chart-wise advanced scripts.

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FOTBYXFYoPpz4WoMkDaDE%2Fimage.png?alt=media&#x26;token=a7baa0d6-09a9-4c2a-9382-63150d619871" alt=""><figcaption><p><em>The Advanced Scripting tab displaying the chart-wise advanced scripts</em></p></figcaption></figure>
