How to get the fieldvalue of a particular field of the currentTiddler in a single filter run

{{{ [{$:/HistoryList!!current-tiddler}fields[ ]prefix[sub-]] }}}

This filter will give me the field in the currentTiddler with prefix sub-. Now I want to get its fieldvalue using the same single filter run. Is it possible to get it using a filter run prefix or something similar.

There will only one field in the currentTiddler with prefix sub- I want to get this fieldvalue in the same single filter run itself.

Take a look at the :map filter run prefix: it redefines <currentTiddler> (= {!!title}) based on each input value it receives—that is, each output of the previous filter run. This lets us use the value of the previous filter run as a variable in a new filter.

{{{ [{$:/HistoryList!!current-tiddler}fields[]prefix[sub-]] :map[{$:/HistoryList!!current-tiddler}get{!!title}] }}}

And personally, I’d probably make this a bit more compact by defining {{$:/HistoryList!!current-tiddler}} as a variable:

<$let current={{$:/HistoryList!!current-tiddler}}>
{{{ [<current>fields[]prefix[sub-]] :map[<current>get{!!title}] }}}
</$let>
6 Likes

Thank you @etardiff . It works perfectly

1 Like

Of course nested lists do this as well without needing to cram it all in a single filter.

1 Like

Yes, but this is sometimes less efficient, and it’s explicitly not what @arunnbabu81 asked for in his OP.

This is by no means better, it is just a reflection of how this old sponge operates:

 <$let srcTiddler={{$:/HistoryList!!current-tiddler}}
       srcField={{{ [<srcTiddler>fields[ ]prefix[sub-]] }}} >
 
 {{{ [<srcTiddler>get<srcField>] }}}
 </$let>
1 Like

I think this efficiency is debatable and my point is addressing the question itself. It is really easy to do what a lot of people here do and feel they must solve problems in a single filter and we sometimes go to great lengths, when if you “look outside the box” (the single filter) it is trivial.

  • Using a filter to perform more steps is still processing multiple lists in memory, and in fact to be general in nature, filters may not operate as efficiently as a nested list structure. Nested list are doing this all in memory too.