[TW5] Filtering using field value

1,752 views
Skip to first unread message

Jeremy Wheeler

unread,
Jan 5, 2017, 5:44:45 PM1/5/17
to TiddlyWiki

I’ve just installed tiddlywiki and I’m loving it. I’ve started a project I’ve been meaning to tackle for years...

... but I’m stuck. In some fine-tuning I want to filter the input to a list using one of the Tiddler’s field values (tag-required) but I can’t see how to do it. 

In the following example (from a macro) I can //display// the field value and I can //filter// using currentTiddler...

```
{{!!tag-required}}

<$list filter="[tag[$(currentTiddler)$]sort[title]]">
 <$link to={{!!title}}><$view field="title"/></$link> <$view field={{language!!language}}/><br>
</$list>
```
... but I want to filter on the value of tag-required. Crudely speaking, I want to replace... 

```
$(currentTiddler)$
```
... in the filter by...

```
{{!!tag-required}}

```
... but I can’t find the syntax to do it. I’ve tried support pages and guesswork but I’ve not found the answer. Have I overlooked the obvious or am I barking up the wrong tree?

Mark S.

unread,
Jan 5, 2017, 5:58:51 PM1/5/17
to TiddlyWiki
This seems to do it:

<$list filter="[tag{!!tag-required}sort[title]]">

 <$link to={{!!title}}><$view field="title"/></$link> <$view field={{language!!language}}/>
<br/>
</$list>


Note that you can use a transcluded field inside a filter by substituting single curly brackets for the inner square brackets.

HTH
Mark

Jeremy Wheeler

unread,
Jan 5, 2017, 6:46:22 PM1/5/17
to TiddlyWiki
Thank you Mark and, yes, that works.


Jeremy.

Mark S.

unread,
Jan 5, 2017, 7:38:52 PM1/5/17
to TiddlyWiki
Hi Jeremy,

If you don't mind, I have a bit of interest in documentation. When you say you looked at support pages, what sites or pages did you look at?

Thanks!
Mark

Dmitry Sokolov

unread,
Jan 5, 2017, 10:48:43 PM1/5/17
to TiddlyWiki
Hi Mark,

TW documentation sites are listed here:
http://confocal-manawatu.pbworks.com/w/page/114018229/TiddlyWiki%20Documentation
Please add the missing sites if any found.

Cheers,
Dmitry

Tobias Beer

unread,
Jan 6, 2017, 5:02:19 AM1/6/17
to TiddlyWiki
Hi Dimitry,
 
TW documentation sites are listed here:
http://confocal-manawatu.pbworks.com/w/page/114018229/TiddlyWiki%20Documentation
Please add the missing sites if any found

As for this particular thread, the reference of choice would have been: Filter Parameter,
as can be found in the core documentation and reference on http://tiddlywiki.com.

Best wishes,

Tobias.

Jeremy Wheeler

unread,
Jan 6, 2017, 3:28:56 PM1/6/17
to TiddlyWiki
I must confess I wasn't very systematic. 

I started with Google search terms like "tiddlywiki filter" and "tiddlywiki filter syntax" and followed likely looking leads. I have a technical background and have made superficial use of a number of programming and markup languages but my knowledge is very out of date so the locations I found most useful were the ones with example markup. I wouldn't necessarily understand the syntax but I would take it as an example and make small incremental changes towards my goals, While the changes worked I kept going forward, when they didn't I backed off and re-grouped.

The best locations I recall were this forum (it seemed to work very well - and it did for me) and tiddlywiki's own http://tiddlywiki.com/static/Introduction%2520to%2520filter%2520notation.html.

Tobias, I see, has posted a link to Filter Parameter. I saw that when I was searching that but didn't "get it" at the time. In hindsight and with this solution it now makes perfect sense (of course). I think my personal challenge is getting used to that style of documentation.


Jeremy.  
Reply all
Reply to author
Forward
0 new messages