When you have a menu that accepts multiple selections, the selections get saved as a list, which is formatted like this: ["first selection", "second selection", "third selection"] etc...
As a result, you can't do {if: choices="first selection"} but rather need to use the includes() function.
Your snippet would look like:
Hello all : {formmenu: apple; banana; cherry; name=choices; multiple=yes}.
Hi Jennifer, the "contains" function is used to check if a string contains a specific substring. For example, if we have the string "apple is good", we can use the "contains" function to check if it contains the substring "apple". On the other hand, the "includes" function is used to check if a list includes a specific element. For instance, if we have a list ["apple", "orange"], we can use the "includes" function to check if it includes the element "apple".
You can use this snippet instead of using includes four times.
{given_list=["item 1", "item B", "item 3", "item 4", "item 5", "item 6", "item 7", "item 8", "item 9", "item 10"]}{if: count(filter(["item A", "item B", "item C", "item D"], (x) -> includes(given_list, x)))>0}Your list contains any of item A, item B, item C, or item D{endif}
The filter function, along with the lambda (x)->includes(given_list, x), is used to only select elements that are present in the given_list. We then check the count, which is the length of the list, to see if it is greater than 0. If there are items such as ["item A", "item B", "item C", "item D"] present in the given list, then the count will be greater than 0. For further information, you can refer to this documentation link.