As it’s not possible to change the type of datafield once it is created, you should make the correct decision to when creating a datafield. I was wondering what the exact differences are between text and list of texts datafields? Is the difference just that you write “abc” in #concept^list
or #concept^text = “abc”:
or are there any other consequences?
Hi Bernd,
Excellent question!
We notice that some users always choose a (repeating) “list of text”, instead of a simple text field, because it offers more flexibility.
However, I would really advise against this practice, because of the additional mental and technical complexity involved of dealing with multiple values, as opposed to a single value:
-
While a single text value (“alpha”) will simply output as that single piece of text (“alpha”), you will have to actively think how to output multiple values of text. Do you want to show a list of three items as “alpha, beta and gamma”? Or as “alpha, beta, gamma”? Or as “alpha, beta or gamma”? What happens if a user happens to enter two identical values in the list?
-
Most of the @special-functions for manipulating text — e.g.,
@trim
,@sub
,@length
,@a-or-an
,@lowercase
, etc. must be used with a single piece of text. You can use these functions with multiple text values, if combined with for example@for
,@get
and@filter
, but this is quite advanced. -
Another good illustration of the additional complexity can be found in a Q&A, where the list of condition types is much longer for text lists:
By way of summary: only use a (repeating) list of text when you are quite sure that multiple values will be needed today or somewhere in the future. Otherwise, the additional flexibility is probably not worth the extra effort and complexity.
Hi Maarten,
Thanks for the explanation, that makes sense!