Tiddler made from content of filtered tiddlers

Hello TW-Experts,

My problem is a little bit more complex and I fail to solve it my myself.
It is a mixture of usage of fields, tags, list and other commands.

I want to generate a Tiddler by using a $list and to display the content of the results. The content of the filtered tiddlers is formatted or generated.

Here an example of tiddlers in my wiki.

  • All tiddlers have a tag “visible” if they are allowed to be shown.
  • All tiddlers have a field named Search Field as selector
  • There are different other fields to use as Sort Field but in my example here I have only sort field but this must be flexible
Search field: 1
Sort Field: C
created: 20250428064557977
modified: 20250512055900342
tags: Visible
title: Tiddler A
type: 

"""
Information is an abstract concept that refers to something which has the power to inform. At the most fundamental level, it pertains to the interpretation (perhaps formally) of that which may be sensed, or their abstractions. Any natural process that is not completely random and any observable pattern in any medium can be said to convey some amount of information. Whereas digital signals and other data use discrete signs to convey information, other phenomena and artifacts such as analogue signals, poems, pictures, music or other sounds, and currents convey information in a more continuous form.[1] Information is not knowledge itself, but the meaning that may be derived from a representation through interpretation.[2]
The concept of information is relevant or connected to various concepts,[3] including constraint, communication, control, data, form, education, knowledge, meaning, understanding, mental stimuli, pattern, perception, proposition, representation, and entropy.
Information is often processed iteratively: Data available at one step are processed into information to be interpreted and processed at the next step. For example, in written text each symbol or letter conveys information relevant to the word it is part of, each word conveys information relevant to the phrase it is part of, each phrase conveys information relevant to the sentence it is part of, and so on until at the final step information is interpreted and becomes knowledge in a given domain. In a digital signal, bits may be interpreted into the symbols, letters, numbers, or structures that convey the information available at the next level up. The key characteristic of information is that it is subject to interpretation and processing.
"""
Search field: 1
Sort Field: B
created: 20250428064928504
modified: 20250512055916538
tags: Visible
title: Tiddler B

Here is a Table

|1a|1b|1c|
|2a|2b|2c|
|3a|3b|3c|

Address: On the road
Name: Stefan
Search field: 1
Sort Field: A
created: 20250428065118017
modified: 20250512055930130
tags: Visible
title: Tiddler C

Name: {{!!Name}}<br>
Address: {{!!Address}}

Search field: 2
Sort Field: A
created: 20250428070102836
modified: 20250512055938663
tags: Visible
title: Tiddler D

This is another content

I want to use this kind of tiddler to generate my result

  • tag{Visible]
  • Content of Search Field = Content of Searched_by
  • Sorted by the field given as content in Sorted_by
Searched_by: 1
Sorted_by: Sort Field
created: 20250512061026309
modified: 20250512061209795
tags: 
title: Generated Tiddler

The result should look like this

Name: Stefan
Address: On the road

Here is a Table

1a 1b 1c
2a 2b 2c
3a 3b 3c

Information is an abstract concept that refers to something which has the power to inform. At the most fundamental level, it pertains to the interpretation (perhaps formally) of that which may be sensed, or their abstractions. Any natural process that is not completely random and any observable pattern in any medium can be said to convey some amount of information. Whereas digital signals and other data use discrete signs to convey information, other phenomena and artifacts such as analogue signals, poems, pictures, music or other sounds, and currents convey information in a more continuous form.[1] Information is not knowledge itself, but the meaning that may be derived from a representation through interpretation.[2]
The concept of information is relevant or connected to various concepts,[3] including constraint, communication, control, data, form, education, knowledge, meaning, understanding, mental stimuli, pattern, perception, proposition, representation, and entropy.
Information is often processed iteratively: Data available at one step are processed into information to be interpreted and processed at the next step. For example, in written text each symbol or letter conveys information relevant to the word it is part of, each word conveys information relevant to the phrase it is part of, each phrase conveys information relevant to the sentence it is part of, and so on until at the final step information is interpreted and becomes knowledge in a given domain. In a digital signal, bits may be interpreted into the symbols, letters, numbers, or structures that convey the information available at the next level up. The key characteristic of information is that it is subject to interpretation and processing.

I really need help get this filtered and displayed.

Thank you in advance for your help
Stefan

<$list filter="[tag[Visible]sort[Sort Field]]">

 {{!!text}}

</$list>

Maybe this will make it happen. There are two suggestions, the first one is that you could prepare json files of these demo entries. That way other people can start testing as soon as they import them, rather than having to create new ones all over again. The second suggestion is that the field names should preferably not contain spaces. For example, if you have a search field in your requirements, but it’s not very filterable because of the presence of spaces. If you have the need for this, it is recommended to change to other forms, such as camel naming or adding hyphens and so on.

I don’t know how to filter field names that contain spaces, maybe store it as a variable to achieve that.

I’m hoping that by “generate” here you mean only that you will display this content when that tiddler is shown. If instead you mean that you will create a new tiddler with that content embedded, then I think you’re missing one of the fundamental ideas of tiddlywiki, noted in The Philosophy of Tiddlers.

This is a simpler problem than you seem to fear. This would probably do:

<$list filter="[tag[Visible]search-field{!!searched-by}sort{!!sorted-by}]">
    <$transclude $mode="block"/>
</$list>

Ideally, you will need to find a way to apply that to multiple tiddlers without resorting to cut-and-paste. My suggestion would be to assign a tag for this purpose, let’s say, “Dynamic”, and then use a ViewTemplate.

It might looks something like this:

title: $:/_/my/viewtemplates/dynamic
tags: $:/tags/ViewTemplate
list-after: $:/core/ui/ViewTemplate/body

<% if [<currentTiddler>tag[Dynamic]] %>
  <$list filter="[tag[Visible]search-field{!!searched-by}sort{!!sorted-by}]">
    <$transclude $mode="block"/>
  </$list>
<% endif %>

You can see this in action by downloading the following and dragging it onto a wiki: GeneratedTiddler.json (3.2 KB)

1 Like

Hi @Scott_Sauyet,

you are right, “generate” means only that I want to display the content.

Your code is not completely that what I am looking for, and I do not know where to correct it.
The passage search-field{!!searched-by} is not filtering out the tiddlers where “Search field” is what is the content of the field Searched_by , in my examples “1”.
If I use your code also Tiddler D will be listed and this Tiddler has a “2” in the field “Search field”.
I added my examples as JSON file here.

Thank you very much for your help.

P.S.: The use case is simple here. Some people (children) are writing articles like a newspaper and we want to display to the parents only the complete newspaper, made of the articles.

Stefan

P.P.S.: I like the idea with your $:/_/my/viewtemplates/dynamic Tiddler. Maybe I can use it also for another use case.

tiddlers.json (2.5 KB)

As @dongrentianyu mentioned, spaces in field names are quite a problem. I forgot to mention before I posted that I changed the relevant field names to lower-case, hyphen-separated names. While there is no universal agreement on field naming, that is the most common one I’ve seen, with snake_casing and camelCasing far behind.

If you absolutely have to have those spaces in the names, then I’m not sure how to write such a filter. It might get quite complex.

<$list filter="[all[tiddlers]tag[Visible]has[Search field]Search field[1]sort[Sort Field]]">

 {{!!text}}

</$list>

Okay, this is a little beyond me. It turns out that fields can contain spaces, and use them just like fields that don’t. TiddlyWiki is still too powerful.

@stefan_from_germany Maybe this will make it happen.

1 Like

I did find a way that worked:

<% if [<currentTiddler>tag[Dynamic]] %>
  <$let searchedBy = {{{ [{!!Searched_by}] }}} sortedBy = {{{ [{!!Sorted_by}] }}} >
    <$list filter="[tag[Visible]] :filter[get[Search field]match<searchedBy>] +[sort<sortedBy>]">
      <$transclude $mode="block"/>
    </$list>
  </$let>
<% endif %>

GeneratedTiddler.json (3.1 KB)

But I would still recommend removing the spaces if at all possible.

1 Like

Wow, I really had no idea!

So my answer above can be simplified to

<% if [<currentTiddler>tag[Dynamic]] %>
  <$list filter="[tag[Visible]Search field{!!Searched_by}sort{!!Sorted_by}]">
    <$transclude $mode="block"/>
  </$list>
<% endif %>

Still, I would recommend against them.

1 Like

Hi @Scott_Sauyet,

I changed

  • “Search Field” with “search-field”
  • “Sort Field” with “sort-field”
  • “Searched_by” with “sorted-by”
  • “Sorted_by” with “sorted-by”

and everything is as expected.

Thank you so much. I will forward this requirement to the kids and we will publish next week the first newspaper to the parents.

Stefan