I need help creating a search filter for Tiddlywiki that lists all the tiddlers with the currentPatient tag plus all the tiddlers that have a prefix starting with the title of the tiddlers with the CurrentPatient tag. Could you help create one? If it helps, those tiddlers also have another tag called ‘patientNotes’. I’ve tried Gemini 2.5 pro and ChatGPT 4o and they failed spectacularly.
I want to be able to enter the filter into the advanced search and export the tiddlers listed.
Conveniently, a tiddler is always prefixed with itself, so prefix[Patient A] will find both Patient A and Patient A Notes (as well as Patient ABC, etc.) This means all we need to do is:
Get a list of all tiddlers with the currentPatient tag Filter:[tag[currentPatient]]
Convert that list to a list of all tiddlers prefixed with any of the tiddlers found by the previous filter run. Filter::map:flat[all[tiddlers]prefix<currentTiddler>]
The :map filter run prefix is a special kind of secondary filter prefix that says, "evaluate the following filter for each output of the previous filter, treating that output as <<currentTiddler>>". The additional :flat suffix ensures that we’ll get all tiddlers that match the filter, not just the first result for each input value.