Show the values of another tiddler's field as a list with a filter

If I have a Painting1 tiddler with field Painter = John Smith, how can I, in the “Painting1” tiddler, display a list of John Smith’s other works, listed in the latter’s “Works” field?

That is:
-The tiddler Painting1 has the field Painter with value = John Smith.
-The John Smith tiddler has the field Works with value = Painting1 Painting2 Painting3 Painting4 [[Name of the artwork]]

How can I, with a filter, make the list appear from within the Painting1 tiddler?

Works by {{!!Painter}}: Some filter (?) …

…Painting1
Painting2
Painting3
Painting4
Name of the artwork

I was thinking of using the “listed” operator

For every tiddler with a field Painter with the same field value as the current tiddler:
{{{ [Painter{!!Painter}] :except[<currentTiddler>] }}}

or

Every tiddler listed in the Works field of the painter given in the Painter field of the current tiddler:
{{{ [{!!!Painter}get[Works]enlist-input[]] :except[<currentTiddler>] }}}

1 Like

Thank you very much. Sorry for the question (could be a not so smart one :sweat_smile:), but how should I use this filter to make the list appear?

See https://tiddlywiki.com/#list-links%20Macro:[[list-links%20Macro]]%20[[list-links%20Macro%20(Examples)]]

Thanks again, just one last thing, what if I wanted to make a list that follows a template and not a list of links? (In the example I admit that a list of links seems to be the most useful thing, but I care about only text that follows a template)

Ah, @saqimtiaz gave you shorthand for listing links. But the basic mechanism of the list widget can be used to show whatever you like about the tiddlers in question.

For example, the following code would work with that initial list of tiddlers (for other paintings by the same artist) and show the title for the tiddler, followed by the date (in parens), and then the contents of a “gallery” field (imagining you might have a field showing where the painting is displayed):

<$list filter="[Painter{!!Painter}] :except[<currentTiddler>]">
{{!!title}} ({{!!date}}) {{!!gallery}} <br>
</$list>

UNSOLICITED ADVICE :upside_down_face: : For what it’s worth, I would not recommend having a field in the painter’s “home” tiddler that stores a list of their works. A field is rarely the best place to house a list (with this exception: tags automatically use their list field to track your preferred ordering of tagged items, without your having to interact with that field).

Using a field to house a list (when you also have tiddlers for the listed items) leads to double-maintenance burdens, and potential confusion. Once your list gets long, it’s especially brittle (easy to mess up the field or to interrupt the double-bracket syntax needed for multi-word titles, etc.).

Instead, just have a tiddler for each painting, and make the painter’s “home” tiddler find (and display a list for) exactly the relevant painting-tiddlers:

<$list filter="[Painter<currentTiddler>]">
{{!!title}} ({{!!date}}) {{!!gallery}} <br>
</$list>

AH, editing to add: You did ask about a template.

The idea is pretty much the same. Create a tiddler called (for example) paintings-overview and having contents however you like. On my simple version, the “guts” of the list were like this, but I’ll add an image widget, floated off to the right:

@@float:right; <$image width="120" source={{!!image}}>@@
{{!!title}} ({{!!date}}) {{!!gallery}} <br>

Then, your list could look like this:

<$list filter="[Painter<currentTiddler>]">
{{||paintings-overview}}
</$list>

What’s nice here is that this same template could also be used for other lists. (And of course editing the template is a very efficient way to get your preferred view showing up everywhere at once.) For example, all paintings with the tag “flowers” could be displayed with your template, or all that have “MoMA” listed in the gallery field, etc.

You could also consider using a thumbnail gallery, which is a bit more complex, but makes a nice set of clickable images. Learn more here:

https://tiddlywiki.com/#list-thumbnails%20Macro%20(Examples)

4 Likes

Thanks you very much, I’ll look into it tomorrow. It looks promising :grinning:

For completeness this will also work;

<$list filter="[Painter<currentTiddler>]" template=paintings-overview/>
3 Likes

This discussion is giving me some interesting ideas about templates, if I come up with something interesting I will share it.
Thanks again everyone!