# 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.66/nedyx/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://1085786630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWv5M2BoEVu0kDIV5EPs4%2Fuploads%2Fgit-blob-b52f7c0213e88a397ec75dd682a1e6f39539da6a%2Fimage.png?alt=media" 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://1085786630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWv5M2BoEVu0kDIV5EPs4%2Fuploads%2Fgit-blob-7eb3d0048cfafcb80ae9140ff1841f196dd58574%2Fimage.png?alt=media" 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://1085786630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWv5M2BoEVu0kDIV5EPs4%2Fuploads%2Fgit-blob-356c7930f4fd5b1661a7eaf891bb43775f18da3d%2Fimage.png?alt=media" 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://1085786630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWv5M2BoEVu0kDIV5EPs4%2Fuploads%2Fgit-blob-e9dbcafea2b3e19e0d128bfc808bcfdc3a9c9a80%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure></div>
