Mapping Values to dynamically enter other values in the snippet

Hi There!
I'm trying to set up that if my formmenu get's a specific value, the rest of the snippet should update a certain text field to show different data based off what was selected in the formmenu. This would be similar to a dictionary in python or a map in other languages.

IE, if formmenu was a year field set to "2020", a later field would then populate to say "Watch out for that corona..." while if it was set to 2019 it might say "You're living in the past!".

I know I can accomplish this using if/else statements but considering I'm expecting my formmenu list to have a lot of options, I'm trying to make the code as unsloppy as possible...

Is there currently a way to do something like this in text blaze?

Hi, and welcome to the forum! :slight_smile:

A Python dictionary is similar to a Text Blaze keyed list:

For example:

{mapping=[
"2018"="Two years ago",
"2019"="Last year!",
"2020"="It's 2020"
]}

{formmenu: 2018; 2019; 2020; name=year}

{=mapping[year]}

AH! Perfect!! Thank you so much!
Just saved me from overly complex if else statements....