Copy of Snippet "Quick Multple List"

{note: preview=no; trim=yes}
{multipleoptions=["multipleoption1", "multipleoption2", "multipleoption3", "Other..."]}
Defining the list of items to be used as values in the "menu2" formmenu command.
{endnote: trim=right}

{note: preview=yes; trim=yes}
{formmenu: name=menu2; values={=multipleoptions}; multiple=yes}
{endnote: trim=right}
{note: preview=no; trim=yes}
Creating a formmenu command with the name "menu2" and using the items from the list named "multipleoptions" (defined earlier) as values to be used in the menu.
{endnote: trim=right}

{note: preview=no; trim=yes}
When I count the number of choices picked in menu2, is it more than zero? If the answer is "yes", do the following. If the answer is "no", skip to the endif command. NOTE: when you click on the if command, its corresponding endif will be highlighted.
{endnote: trim=right}

{if: count(menu2) > 0; trim=yes}

{note: preview=no; trim=yes}
Creating a repeat loop called menu2locals. Everything inside the repeat loop (up to endrepeat) will be repeated by the number of options picked in menu2. NOTE: "choice" can be renamed to anything, but once you've picked a label, you need to keep using it throughout the snippet.

{endnote: trim=right}
{repeat: for choice in menu2; locals=menu2locals; trim=yes}

{if: choice == "Other..."; trim=right}{note}Please specify...{formtext: name=otherchoice; trim=right}{endnote}{item=otherchoice}
{else: trim=right}
{item=choice; trim=right}
{endif: trim=right}
{endrepeat: trim=right}
{endif: trim=left}

{localsList=map(menu2locals, menu2local -> menu2local.item); trim=right}
{note: preview=no; trim=yes}
I'm using the map function to process the items in the menu2locals repeat loop. Each "choice" (the repetition variable I mentioned above) in the menu2locals loop is now being given the name "menu2local" (singular) and being added to a list called "localsList" (see start of the command).

{endnote: trim=right}

{=join(localsList, "\n"); trim=yes}
{note: preview=no}
Here I'm taking all of the items in "localList" and joining them with a line-break (represented by "\n")

{endnote: trim=right}

{note: preview=no}
Here's what the contents of "localsList" would look like if I didn't do the step above:
{=localsList}
{endnote: trim=yes}

Hi @George_Marinos,

I've modified the snippet to get it to do what you need it to do.

Additionally, I've added note to help you understand exactly what I'm doing.

Hope this helps :slight_smile:

It is fantastic

One small issue - how do I get the "Other..." function to work?

@George_Marinos, sorry I had missed an important step. I've fixed it now. Try it again please.