The documentation for the <$action-listops>
widget states:
Both of the following yield the same result:
<$action-listops $subfilter="-[[List Item]]"/> <$action-listops $subfilter="+[remove[List Item]]"/>
However, these behave differently:
- The :except filter run prefix removes its output titles from the list of input titles; here there is no
split[ ]
so the single item “List Item” will be removed. - The remove operator treats its parameter as an array and thus will remove two items, “List” and “Item”, from the list.
Thus, if the original list was [[List Item]] List [[List My Item]] Item
, then:
- By using
-[[List Item]]
we would end up withList [[List My Item]] Item
- By using
+[remove[List Item]]
we would end up with[[List Item]] [[List My Item]]
Am I right that the documentation is incorrect here, or have I overlooked something?
(Of course, if there were no space in the example, such as if it were “ListItem” or “List-Item”, then the two versions would have the same effect.)
Edit:
To be clear, this post is about the quoted part of the documentation for the <$action-listops>
widget being incorrect, and not about whether the remove
filter operator (or :except
filter run prefix) function correctly. (As far as I can tell, they function correctly.)
Additional discussion and testing of the remove
operator (see especially @TW_Tones’s post below) seems to show that the remove
operator treats its parameter as a title list, which we assume to be how it is intended. However, the documentation for the remove
operator doesn’t say it’s parameter is a “title list” but only that it is an “array”, which unclear (and even the examples don’t make it clear that it’s a title list as opposed to, say, an array of space-separated values). Thus, in addition to the correction needed to the <$action-listops>
widget documentation as pointed out in the original post, I think the remove
filter operator documentation could use an update to specifically say the parameter is specifically a title list.
- We have not decided what to write in place of the incorrect portion of the
<$action-listops>
widget documentation. The purpose of that part of the documentation was to give examples of ways to use the widget to remove values from a list field, so my take would be that it can say that you can use-[[List Item]]
or+[remove[Item]]
to remove items from the list, but also say that if the item you want to remove has spaces, you have to either use-[[List Item]]
or use remove with a soft parameter (such as+[remove{tid!!list}]
), whereas+[remove[Item1 Item2]]
works great to remove multiple items as long as none of the items has a space (and the same is achievable as-Item1 -Item2
).