Formating with checkboxes and field names in variables

I am trying to style an element based on the value of a generated field.

If the name of the field is known by advance and can be set in the filter, we can process like in this simplified example :

<$let 
test1="background-color: red;"
test2="background-color: blue;"
Style={{{ [[TN]] [[element2]] +[join[]] }}} >
<div style={{{ [{!!TNelement2}match[yes]then<test1>else<test2>] }}} >
      
        <$checkbox field=<<Style>> checked="yes" unchecked="" default=""/> <br>
        content

  </div>
</$let>

But I will need to have the field name generated in an other step.
I tried multiple variation on how to write the value, but none work. Here is one of my failed attempt as an illustration :

<$let 
test1="background-color: red;"
test2="background-color: blue;"
Style={{{ [[TN]] [[element]] +[join[]] }}}
StyleH={{{ [[{!!]] [[TN]] [[element}]] +[join[]] }}} >
<div style={{{ [<StyleH>match[yes]then<test1>else<test2>] }}} >
      
        <$checkbox field=<<Style>> checked="yes" unchecked="" default=""/> <br>
        content 

  </div>
</$let>

I tried multiple variations in its writing, but couldn’t find a way to get <StyleH> to be identified properly.

Is there a specific way to write it ?
Or could there be an other way to apply a style based on a checkbox affecting a generated field ?

Try this:

StyleH={{{ [<currentTiddler>get<Style>] }}}

-e

1 Like

Thank you.

To be honest, each time I ask for help on this forum, I feel like I’ve wasted hours trying to pick an open door. :joy:
I’ll note that trick. On the plus side, TiddlyWikis are great for holding that kind of infos…