If you put a “list” into the “Valid if” part of an Enum or Enumlist column, the content of that list can then be selected by the user. An advantage of using the “Valid if” part of the in this way is that the contents of the enum (what the user sees as choices) can as data is added to or erased from the app.
In the app I’m working on right now, I wanted such lists to be made from a record called “Tags” into which the users can type whatever they wish and then the contents would be parsed automatically by the app. I wanted spaces and commas to function as separators (delimiters). Also, I wanted to make sure the text typed by unpredictable humans could be parsed properly even if the human used commas and spaces in odd ways. I have the humans type in their tag information as text and then parse it in a virtual column with the following expression.
unique(
sort(
split(
substitute(
[Tags]," ",",")
,",")
)
)-list("")-list(" ")-list(",")
As you can see, I first convert all of the spaces into commas. Then, it is made into a “list” with the SPLIT. The main problem with the list at this point is that all of those commas have produced a lot of empty list items. UNIQUE() gets rid of the repeats but I can still be left with the following kind of situation:
I learned from @Steve that empty list items can be removed with -LIST(""). Then, through trial and error, I learned that combinations of list altering virtual columns in my app were also producing “,” and " " as list items. Thus, the following three subtractions at the end of my expression are designed to eliminate all three unwanted list items:
-list("")-list(" “)-list(”,")
By the way, I found that the “Valid if” part of an enum column can be sensitive to the history of the list (where it came from and what virtual columns had changed it in the past). My lists appeared as follows if I used too many virtual columns:
I found that it was better to avoid a long chain of virtual columns and do as much as I could directly in the “Valid if” space, even if that meant creating a rather complicated expression.
Finally, I learned from @Suvrutt_Gurjar and @Steve to be careful about expecting too much from the LIST() expression when dealing with expressions.
list(“1 , 2 , 3”)
merely interprets “1 , 2 , 3” as the sole component of a list of one – not as a list column with {1 , 2 , 3} as the expression.
Thanks to @Suvrutt_Gurjar and @Steve for their help on the following thread:
Thanks to them, my app is now working well.