Accessing drop down values in variable template

We are constructing a variable for an application cache connection string, which uses (among other things) a cache name and a cache key. I was hoping to reduce the number of variables by creating a drop down template variable for the cache using:
However, I don’t see any way of being able to access the display value (ie the cache name), only the cache-key value. Is there any way of implementing this without having to use separate variables for the cache key and name?

Hi there,

Thanks for reaching out!

Unfortunately at present there is no way to get the display value in this scenario.

About the best thing we can come up with is to use a separate variable which is a json blob which you can use to look up the cache name. Unfortunately this means you end up having to duplicate the display values, but it means you limit the duplication to the two spots.

To do this (assuming you’ve got a dropdown template variable Cache as you’ve described), add a variable CacheLookup with the json blob, such as {"cache-key1": "cache-name1","cache-key2": "cache-name1"}, and then in your deployment script, you can access via #{CacheLookup[#{Cache}]}.

Hope this helps!


Thanks Matt, that’s a good suggestion, I’ll try implementing that.

Cheers, Simon.