How to Use Dynamic Choices in Prompt for User Input Action? [Answered]

###How to Use Dynamic Choices in Prompt for User Input Action?

Is there a way to do this? I want to build the list in a variable, and then use that variable as the choices. I tried the below, but it doesn't work. KM treats my variable with the choice list as a single choice.

###Answer:


TEST Dynamic Choice List.kmmacros (4.1 KB)

###Here's the result:

Not sure if the MRU language and topic lists in this macro look relevant:

Thanks. The short version is to insert the variable in the prompt at the start of the default value entry:
|%Variable%Author%|%Variable%AuthorList%

###This works:

Result is:

When I have time, I'll add this technique to the KM Wiki.

1 Like

Question Answered! :+1:

@ccstone has provided the key to this solution:
Put a vertical bar FIRST, before the variable that contains the list, in the Default Value, like this:
|%Variable%AuthorList%

The vertical bar causes KM to interpret the following variable, which is a list of choices with vertical bars, as a normal set of choices.

####So it looks something like this:


The Result:

1 Like