# Datafields

### @assigned <a href="#assigned" id="assigned"></a>

* parameter: a datafield
* returns true or false
* see also: @implemented and @cascade

Returns true if *some* value is assigned to the datafield (i.e., if the datafield is not equal to *unassigned).*

Tip: you can easily invert the behaviour of this special function: `not(@assigned(#concept^datafield))` will return true if the datafield is *not* assigned any value.

In visual terms, the `@assigned` function actually boils down to the question whether the data dashboard shows the left side (= no value assigned) or the right side.

<figure><img src="https://1353649376-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaTEDNbiFdDa6DW2eNG17%2Fuploads%2F2iGIRtMVIrVkrPJpOfkD%2Fimage.png?alt=media&#x26;token=1a6a89c7-885f-4e29-8434-74f2f41de010" alt="" width="563"><figcaption><p><code>date</code> and <code>delivery-location</code> are not assigned any value</p></figcaption></figure>

<figure><img src="https://1353649376-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaTEDNbiFdDa6DW2eNG17%2Fuploads%2FcxjsbW2JrC0QgQMyuNZK%2Fimage.png?alt=media&#x26;token=9ebb1cd5-5080-43ee-b4bf-1b4208111fa2" alt="" width="375"><figcaption><p><code>date</code> is assigned a value (so that <code>@assigned(#order^date)</code> would return <code>true</code>), while <code>delivery-location</code> is still not assigned a value</p></figcaption></figure>

{% hint style="danger" %}
The `@assigned` function may cause quite some surprises for new users.

Be aware that assigning an *empty text* value to a text datafield (visually shown in the data dashboard as an empty text box) causes the `@assigned` function to return true for that datafield.\
\
Similar surprises will happen with:\
\* assigning the value *false* to a true/false datafield (visually represented as a checkbox that is not checked)\
\* assigning the value 0 to a number datafield\
\* assigning a collection of no items to a list of text or repeating datafield — which will already happen in a Q\&A when a question has been associated with this datafield

because all of these situation cause the `@assigned` function to return true for that datafield, because “something” is assigned (yes, even an empty collection is “something”). This will probably come as a surprise if you are new to thinking in data types.

Tip: to check whether at least one item is assigned to a list of text or repeating datafield, you can use `@count(#concept^datafield) > 0`
{% endhint %}
