@assigned special function doesn't work in Q&A


In a document I am working on, I used the @assigned(#concept^datafield) in enabled in assemble document for several clauses. This works perfectly in assemble document.

However, when I made the Q&A, the clauses don’t disappear, even though no datafield is filled in.

How can I resolve this issue?

Thanks in advance!

Hi Isha,

Unfortunately, due to the alphabetical ordering, the @assigned special function is one of the earliest functions that users will come across when checking the list of special functions.

Perhaps this was not entirely evident from its documentation, but the @assigned special function should only be used in a very limited number of scenarios, because it tends to confuse lawyers without a formal programming background.

What this function essentially does, is checking whether “something” has been assigned to a datafield — but that “something” can also be an “empty collection”. Indeed, from a mathematical point of view, the empty collection is also a “thing”.

That empty collection is what you are encountering here. As soon as a Q&A question is associated with a list-of-text datafield (or repeating datafield), and that question is not disabled, it gets set to the value “empty collection”. If a user then checks a predefined answer (or adds her own custom answer, or when a predefined answer is set as the default answer), the empty collection gets filled with other items.

So note that even when the user does not actually check a predefined answer, the datafield associated with that question has some value — even when it is the weird-looking “empty collection”. This differentiates such question from a question that got disabled, which has no value.

The @assigned merely checks whether a datafield has some value, i.e. is in a state opposite of “no value”. There are a few very specific use cases where it can be useful to perform this check (e.g., to check inside a clause whether some question actually was disabled), but they are quite advanced, so no need to worry about them.

In your particular scenario, it is much easier to perform a check on @count(#concept^datafield) > 0, or even simply #concept^datafield (which will, for a list-of-text datafield, internally boil down to the same).