I can filter on Tags OK, but I cannot get the syntax right to filter on a field value, or find any relevant examples in the documentaion wiki.
This works as I expect, giving me a list of links:
<<list-links “[tag[SomeTagName]]”>>
I want to select only a subset of tiddlers that have a field with a particular value, but this does not work:
<<list-links “[field:SomeFieldName|[FieldValue]]”>>
Your syntax seems correct. My best guess is that you are using field names with upper case characters. They are case sensitive. For example [field:Type[image/png]] wouldn’t find anything, because the field is named type, not Type.
Hi, can you explain further as this does not seem to be my situation. I am trying to search a Field for a specific value and list those Tiddlers that match it.
Does the ClassName field always contain a single option, or would a value like ClassName: English, French be possible? If so, you’ll need the search operator rather than ClassName/field:ClassName, which only returns exact field matches. For instance, to find all non-shadow tiddlers whose ClassName contains “English” (and potentially other values): [search:ClassName[English]]
Ah, that works. Now I think I can see the problem I have. Some of my field values are enclosed in square brackets so they appear as links. Like this [[Chemistry]]
Those don’t work, presumably they need to be escaped in someway or put in quotes?
There is no escape syntax for filters, you will need to refer to the field name via variables.
First define the variable, let’s say as fieldValue and then reference it in the filter as ClassName<fieldValue>
In general it is not recommended to use brackets around field values for presentation purposes, you can control how they are displayed without needing the field value to contain brackets around it.
Considering that square brackets have special meanings in wikitext syntax (filters especially), I would attempt to refactor and remove them from field values if possible. A second reason is that by enclosing string values like this, you’re giving them additional special meaning in context of TiddlyWiki, thus overloading the information they carry. I don’t know if there’s a special term for this, but intuitively it makes me want to avoid this. Especially that I consider the hypothetical scenario of working with exported tiddlers content outside of TiddlyWiki. If you know the meaning of the text in a field, just treat it accordingly in the wikitext code that uses it.
As an alternative to search, you can also try using the contains operator instead: it’s intended to work with title lists (i.e space-separated lists with double brackets around multi-word titles), but it will also strip the brackets from its input content, so English and [[English]] will be parsed the same way.
For instance, [contains:ClassName[English]] should find ClassName: English, ClassName: [[English]], and ClassName: [[English]] [[French]] — though it will break on [[English]], because commas are not part of the title-list syntax.
That said, I second @vuk’s advise to keep your wikitext formatting in your tiddler view template, not your field content, for maximum flexibility when filtering. This is intended mostly as a quick workaround if you don’t want to refactor all your fields at this point in time.