I thought, this was would to do what I wanted if I replaced title by my field name, item_type, produce a list of all tiddlers having a tag whose value is defined by the field item_type in the current tiddler.
The first part of the filter gets the item_type field from the current tiddler, then passes it on to the second part which finds all tiddlers with that tag and sorts them.
$(...)$ is used to reference macro parameters and not the current tiddler’s field. That’s probably why it is not working.
Ooo… thank you… for a while now I’ve been thinking that such a thing would be really useful and here it is. So useful (am I allowed to award a ?).
Very nice idea. I might want to go one step further, and choose the options as those Tag Tiddlers that themselves have a certain tag, like, say, TableOfContents:
Select the type item: <$select field="item_type" default="Items">
<$list filter=[tag[TableOfContents]]>
<option>{{!!title}}</option>
</$list>
</$select>
<<list-links "[tag{!!item_type}] +[tagging[]sort[title]]">>
This should work on the main site, or anything with some tiddlers tagged TableOfContents:
Thanks to all who suggested possibilities. I got the code working but realised that it would be better for me to compare against the value of a type field in every item tiddler rather than a tag value. On creation, every item tiddler gets a object_type field with its value being one of the options in the $select statement.
''Select the type of item you are interested in from the dropdown below. To see all items, use click [[Items]]''
Item type: <$select field='item_type' default="Items">
<option>35mm Negative</option>
<option>Book</option>
<option>Catalogue</option>
<option>Essay</option>
<option>Exhibition</option>
<option>Exhibition Price Sheet</option>
<option>Exhibition Review</option>
<option>Invitation</option>
<option>Letter</option>
<option>Newspaper</option>
<option>Obituary</option>
<option>Page</option>
<option>Photo</option>
</$select>
The following is the list of items types you have selected.
<<list-links filter:"[field:object_type{!!item_type}]+[sort[title]]" emptyMessage:"Sorry nothing of that type found">>
So, studying the filter syntax documentation, I concluded the list-links statement above might work, and it does!!
Thank you everyone for your patience but I think I am getting the hang of it
You can do this by tagging your tags…
Create a tiddler entitled “35mm Negative” and tag it “Item Type”.
Proceed the same for every option in your list.
Then you can use this code (untested, and adapted from @Scott_Sauyet’s code and yours):
Select the type of item you are interested in from the dropdown below. To see all items, select //Items//.
Item type: <$select field='item_type' default="Items">
<$list filter=[tag[Item Type]]>
<option>{{!!title}}</option>
</$list>
</$select>
<<list-links filter:"[tag{!!item_type}] +[tagging[]sort[title]]" emptyMessage:"Sorry nothing of that type found">>
I have worked out how to have a identical <option>...</option> statements in more than one <select> statement.
Just create a tiddler with each of the available options and then instead of typing the various <option> statements in the <select> statements, just type {{tiddlername}} where tidddlername is the name of the tiddler containing the options.
This way, I can make sure that my create and select tiddlers always use the same list.