Datafields

@assigned

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

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

Last updated