Is there a way to filter tiddlers based on field-value
alone, not the field-name
I have many tiddlers with different field-names, but the same field-value
. Is there a way to filter them based on just the field-value, not the filed-name
How about this solution:
<$list filter="[tag[xxx]search:-text:regexp[\b123\b]]">
</$list>
Look into all fields except the text
field for all tiddlers tagged with xxx
have a word 123
. So 8123
or 91230
are excluded
I should have given more details I guess. I have many tiddlers, which have field-names like cloze, budget and many others like this… All of these fields have the same field-value shadow
What I want is to exclude all these tiddlers (with field-value as shadow
irrespective of the field-name) in a filter for creating a button to show a random tiddler based on random filter plug in by yaisog.
Or should I change the way I use fields. Instead of using shadow
as field-value, should I use shadow
as field-name and different field-values based on the tiddler type.
Existence of field is simpler and faster to filter because the you can do ...!has[shadow]
, rather than arbitrary field with value shadow
. For the latter you’d have to investigate every field in the tiddlers, or at least a defined list of fields.
The reason I chose this way was that I can have any number of fields with field-value as shadow
. So I could add tiddlers to different categories by using different field-names and keep the same field-value shadow
. So my OP remains relevant still. Is there any way to do that ?
I am thinking of adding a tag shadow
or field shadow:yes
to all these tiddlers so that I can easily filter them out.
OK, sure, here is one solution to
filter tiddlers based on
field-value
alone, not thefield-name
\define fieldwithvalue()
<$list filter='[all[tiddlers]$(field)$[shadow]]'>
</$list>
\end
<$list filter='[fields[]]' variable=field>
<<fieldwithvalue>>
</$list>
It is probably possible to do it more compactly.
How to use this in the code for random tiddler based on the random filter operator by @Yaisog
<$let numberOfShadows={{{ [all[shadows]count[]] }}}>
<$button actions="""<$action-setfield $tiddler="$:/temp/persistent-shadow" $value={{{ [random<numberOfShadows>] }}} />""">
Click here
</$button>
</$let>
<$reveal type="nomatch" text="" state="$:/temp/persistent-shadow">
<$text text={{{ [all[shadows]sort[]nth{$:/temp/persistent-shadow}] }}} />
</$reveal>
Instead of listing the shadow tiddlers, I want to have random tiddler from a list of my note tiddlers. For that I have to exclude the tiddler with field-value as shadow.
@twMat How to use the code shared by you in the above post in this random tiddler code
Before digging into this, I just want to make sure I don’t misunderstand what it is you want:
“All your note tiddlers” are all tiddlers except shadow tids, or are “note tiddlers” distinguished in some other way?
…and of these, you want a random one but it must not have a field with the value shadow
Correct?
BTW, just so no misunderstanding, you do know that “shadow tiddlers” and the filter all[shadow]
has nothing to do with the field value shadow
, right? The latter is just a value set by the user (you!) and not by the TW system.
yes. My note tiddlers have some fields for categorisation and sub categorisations.
I want to somehow exclude those tiddlers with field-value shadow
Ya. I know about shadow tiddlers in TW core. The tiddlers with field-value shadow
are created by myself - these are mostly tweaks to different sections of the TW UI or TW function made by myself. I categorised them using different field-names based on the category they modify but with the same field-value shadow
Also relevant to this thread which is awfully similar to a few of yours @arunnbabu81
I am not sure if the topic splitting has being warranted here because this one answer of mine is relevant to the “Title words” in at least three of the topics.
@TW_Tones I figured splitting the discussion was a good idea considering my aim was to create a tabbed system to organize tiddlers by field value using the tabs macro and what I later learned, using tabTemplates, whereas the aim here seems to be slightly different, but still sorting by a specific fields value.
Mine was answered in my discussion, however it seems like talk is still going on here as far as how OP would like to use the field and/or field value of shadow.