Access Label and Value of variable prompt type "Dropdown Select"


version introduced “The Options list for Dropdown Select and Checkbox Select variable prompt types can now be split into Labels and Values.”. I had a use case for this right away. Now, if i query the variable such as “%Mode%” it will give me the value. However, i wanted to add the caption to the log. There seems to be no such option though. The logical step was to try “%Mode.Label%”, which would match “%Mode.Value%”. That is not supported though. Any other ideas?

Hi Thomas,

Sorry, the label is not available - only the value is stored. Variables don’t currently have properties and extending the expression engine for variables would be a major piece of work that we cannot prioritise at the moment.

As a workaround, you could use two list variables: one for the label and one for the value as described in option 2 of this post: Variable dictionary / map? populate value based on selected keys in form?.

Alternatively, add the label to the start of each value with a separator e.g. Label:Value, and use the Split function to extract the label $Utils.GetString(%Mode%).Split(":").First()$ and the value $Utils.GetString(%Mode%).Split(":").Last()$.

Hi Dave,

thanks. I’ve added some simple if statements and some redundant text log actions. Not smart, but it’ll do. :slight_smile: