Getting Field Name from a Variable for Use in <$Reveal> Widget

I originally posted this as a comment in this thread but thought it would make more sense as its own thread and moved it as soon as I clicked “submit.”

I’m trying reference a field name stored in a variable to feed a <$reveal> widget.

I have a field name set in a variable, and I want to check the state of that field within a filter to show and hide elements.

This sets the field (referencing the variable):

<$checkbox tiddler="Commercial-wide iPad rollout" field=<<youtrack-created>> checked='done' />

This is how I’m trying to check that field, once set, and determine what elements to show

<$reveal type="nomatch" state=??? text="done">
  <$edit-text field=<<youtrack-issue>> tag="input" type="text" />
</$reveal>

The ??? represents where I’m stuck.

Approaches that definitely don’t work:

  • dropping in the variable directly:
    state=<<youtrack-created>>
  • wikifying the variable:
    <$wikify text="{{!!<<youtrack-created>>}}" name="youtrack-created-field">
  • constructing the variable with Tobias Beer’s Setvars plugin:
    <$setvars _youtrack-created=<<youtrack-created>> youtrack-created-field="\{{!!\ youtrack-created \}}\">

The {{{[get<youtrack-created>]}}} method retrieves the value within my field, but referencing that so I can check it against a value in <$reveal> is throwing me a curveball.

I haven’t been quite desperate enough to try this yet, but I’m wondering if I might have to get the value of the field, write it to a temporary state tiddler, and then check that for my <$reveal> widget. o.O

The reveal widget optionally accepts the attributes stateTitle and stateField (or stateIndex) which will be used preferentially over state if present, allowing you to do something like this:

<$checkbox tiddler=<<tiddler>> field=<<youtrack-created>> checked='done' />

<$reveal type="nomatch" stateTitle=<<tiddler>> stateField=<<youtrack-created>> text="done">
  <$edit-text field=<<youtrack-issue>> tag="input" type="text" />
</$reveal>
1 Like

:exploding_head: That’s exactly what the doctor ordered! Thanks, @etardiff! :partying_face:

1 Like