2014-04-10 18:56:51 +00:00
|
|
|
created: 20140410103123179
|
|
|
|
modified: 20140410103123179
|
2014-09-10 22:42:13 +00:00
|
|
|
tags: Filters
|
|
|
|
caption: each
|
2014-04-10 18:56:51 +00:00
|
|
|
title: FilterOperator: each
|
|
|
|
type: text/vnd.tiddlywiki
|
|
|
|
|
|
|
|
The ''each'' filter operator filters the current list to leave only the first tiddler with each distinct value for a specified field.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
|!Filter String |!Description |
|
|
|
|
|`[all[tiddlers]sort[title]each[type]]` |Returns a list of the first tiddler with each distinct ''type'' field |
|
|
|
|
|
|
|
|
The ''each'' operator can be used to group tiddlers. For example, the following example creates a list of tiddlers split into types:
|
|
|
|
|
|
|
|
<$list filter="[!is[system]has[type]!type[text/vnd.tiddlywiki]each[type]sort[type]]">
|
|
|
|
<div>
|
|
|
|
|
|
|
|
! <$view field="type"/>
|
|
|
|
<$list filter="[type{!!type}!is[system]sort[title]]">
|
|
|
|
<div>
|
|
|
|
<$link to={{!!title}}><$view field="title"/></$link>
|
|
|
|
</div>
|
|
|
|
</$list>
|
|
|
|
</div>
|
|
|
|
</$list>
|