Transclude Dictionary Tiddler by Line?

Wanted a single textarea that searches a list and each line would filter that list (e.g., first line a standard search; second line a title search). It seemed easier if the textarea was a dictionary tiddler and the list filter like so [search{Dictionary Tiddler##1st line}search::literal{Dictionary Tiddler##2nd line}. . . , transcluding by line without writing the name of the value in the textarea when searching. Is there any other way to achieve the same?

Hi @n78c, welcome to the community!

You cannot refer to lines in a dictionary tiddler using line numbers. This is a bit hidden between the lines in the official documentation. The dictionary tiddlers are internally stored the same way the JSON tiddlers are, that is, the order of entries cannot be guaranteed.

You have two options:

  1. Use numbers as indexes, so the dictionary tiddler will look like this:
1: value of first entry
2: value of second entry

You can retrieve these inside filter as {Dictionary Tiddler##1} and so on.

  1. Store the entries as a JSON array, that is, create a tiddler with type application/json with following contents:
["value of first entry","value of second entry"]

You can similarly retrieve these inside filter as {JSON Tiddler##0} and so on (they are 0-based, so ##0 is the first entry).

I hope this helps you. If not, feel free to ask further. The more details you provide on what are you trying to achieve, the easier it will be to help :wink:

1 Like

Thanks vilc,

Wanted to say that if the edit-text widget could edit a dictionary tiddler it would be easier to make the list filter that takes each line as different filter if you could do it by line, but my focus was more on making the textarea to work with that filter (maybe I should have putted this as title?) and the dictionary tiddler was something i thought could make it easier. The following led me to that:

if i have the edit-text widget edit a dictionary tiddler and write this in the text box:

search: word1 lit: word2 tag: word3

then i can easily make the list filter:

`<$list filter="[search{Dictionary Tiddler##search}search::literal{Dictionary Tiddler##lit}search:tags{Dictionary Tiddler##tag}]">

</$list>`

to search in fields and do some/literal search on a single textarea. First i wanted it to do a standard search without writing search:, then if i want to search in the tags of the results i would make a new line that will somehow be added on a different search of the same filter without writing the tag: or lit: each time, it would all be quick and on a single textbox.

I thought if you could transclude it by line you wouldn’t need to write the name of the values each time (I could leave them in the textbox without deleting them, but might not look simple or be done quickly enough as by just hitting enter)