# GETDATA

#### Syntax <a href="#syntax.22" id="syntax.22"></a>

**GETDATA**(*statement*)

* *statement* - the statement which is sent to the database to retrieve the data - ***Value type**: text (optional)*

#### Remarks <a href="#remarks.19" id="remarks.19"></a>

* This function can only be executed by a widget which has a database connection assigned (a button, menu or a table widget), either directly in its Connection tab, or by a reference to another widget (see chapter [Connection property](https://docs.nedyx.com/version-1.52-preview/clearlines-functions/general-aspects/calculated-widget-properties/connection)).
* If GETDATA is called without a parameter, the function returns the content of the database table which is defined in the Connection tab.

<figure><img src="https://content.gitbook.com/content/4X6nN2wTlDsVpd8P1WDM/blobs/2DkjfaOFaZKt8E2GutRp/image.png" alt=""><figcaption></figcaption></figure>

* If GETDATA is called with the parameter *statement*, the string defined by statement is sent to the database instead of the settings in the Connection tab.

<figure><img src="https://content.gitbook.com/content/4X6nN2wTlDsVpd8P1WDM/blobs/SYSY2aprMYIxjrCMs0xD/image.png" alt=""><figcaption></figcaption></figure>

* If GETDATA is called for a hierarchy or a hierarchy menu widget, it returns the data in a hierarchical structure:

<figure><img src="https://content.gitbook.com/content/4X6nN2wTlDsVpd8P1WDM/blobs/olNNylEWswapiPYAM2YD/image.png" alt=""><figcaption><p>The left selected widget is a hierarchy widget, the right widget a table widget. Depending on the widget type, the GETDATA function returns the content in a hierarchical structure. </p></figcaption></figure>

For these widget types, the property "Number of levels" in the Connection tab specifies how many of the first columns define the hierarchy:

<div align="left"><figure><img src="https://content.gitbook.com/content/4X6nN2wTlDsVpd8P1WDM/blobs/1c56PTWbyMhtW9dAtfRk/image.png" alt=""><figcaption></figcaption></figure></div>
