Hallo everyone,
how do I write a one-line filter (a single filter expression) that outputs the value of all (or some of) the fields of a given tiddler? The more I try, the less I’m able to…
Thanks,
CG
Hallo everyone,
how do I write a one-line filter (a single filter expression) that outputs the value of all (or some of) the fields of a given tiddler? The more I try, the less I’m able to…
Thanks,
CG
{{{ [is[current]fields[]!match[text]]:reduce[<…currentTiddler>getformat:titlelist[]addprefix[ ]addprefix]+[enlist-input[]] }}}
wow, awesome! Thanks a lot!
thanking again Télumire for his reply, I wonder now how to push things a little further and write a one-liner that outputs pairs of values, specifically, for each field of a given tiddler, the couple (field_name,field_value). I’m quite confident that to that aim the named prefix :map is the way to go, and indeed by using it it is easy to have at hand in its filter run both the tiddler’s field names and their values. Still I fall short of joining these two data together somehow, so to have (field_name,field_value) as final output of the whole expression.
This code:
{{{ [is[current]fields[]!match[text]]:map[<…currentTiddler>get] }}}
goes as near as I could go in trying to have the desired output, because it returns the tiddler’s fields value; there is a little final step missing to have both the field name and value together…
Thanks for any help/suggestion/tip
CG
I think you want to use one of the default templates (or create your own) :
{{||$:/core/templates/tiddler-metadata}}
If you still want to use a filter expression you can use this :
{{{[is[current]fields[]!match[text]]:reduce[<…currentTiddler>getaddprefix[: ]addprefixformat:titlelist[]addprefix[ ]addprefix]+[enlist-input[]]}}}
or using your more elegant method :
{{{ [is[current]fields[]!match[text]]:map[<…currentTiddler>getaddprefix[: ]addprefix] }}}
Better yet : {{||$:/core/ui/TiddlerFields}}