is it possible to list fields that have a specific prefix ?

119 views
Skip to first unread message

Sebastian Ovide

unread,
Jul 19, 2019, 8:19:38 PM7/19/19
to TiddlyWiki
Hello

I have a tiddler with several fields. Some have a specific prefix. Is it possible to list them ?

example

tiddler!!prefix_aaa, tiddler!!prefix_bbb, tiddler!!prefix_ccc

thanks

Mark S.

unread,
Jul 19, 2019, 9:20:04 PM7/19/19
to TiddlyWiki
Example of fetching fields and values in current tiddler where field name starts with "my" :

<$list filter="[all[current]fields[]prefix[my]]" variable="field">
<$list filter="[all[current]get<field>]" variable="value">
<<field>> : <<value>> <br/>
</$list>
</$list>

Mohammad

unread,
Jul 20, 2019, 12:00:56 AM7/20/19
to TiddlyWiki
Added to TW-Scripts

TonyM

unread,
Jul 20, 2019, 12:16:19 AM7/20/19
to TiddlyWiki
A related tip is fields with say menu-1 menu-2 can be listed in order use sort[] and you can transclude the content. This have active wiki text and more stored in fields.

Regards
Tony

Sebastian Ovide

unread,
Jul 20, 2019, 3:34:26 AM7/20/19
to TiddlyWiki
great thanks !

Todd Corson

unread,
Jul 9, 2023, 6:59:21 PM7/9/23
to TiddlyWiki
How about listing fields whose value has a specific prefix?

Right now I have a list filter that looks like this:

<$list filter="[field:year[1980]] [field:year[1981]] [field:year[1982]] [field:year[1983]] [field:year[1984]] [field:year[1985]] [field:year[1986]] [field:year[1987]] [field:year[1988]] [field:year[1989]] +[tag[Song]get[title]sort[title]]">

It would be so much nicer if I could do something like:

<$list filter="[field:year][prefix[198]][tag[Song]get[title]sort[title]]">

I'll even take any suggestion that lets me use a list or range of years instead of having to specify each one with its own [field:year[]] wrapper.

Thanks,
Todd

Eric Shulman

unread,
Jul 9, 2023, 7:25:54 PM7/9/23
to TiddlyWiki
Try this:
```
<$list filter="[tag[Song]sort[]] :filter[get[year]prefix[198]]">

</$list>
```

Todd Corson

unread,
Jul 10, 2023, 12:45:23 AM7/10/23
to TiddlyWiki
Works perfectly!

Thanks, Eric. I knew there had to be a way to make it more concise.

Scott Sauyet

unread,
Jul 10, 2023, 8:57:27 AM7/10/23
to TiddlyWiki
Eric Shulman wrote:
Try this:
```
<$list filter="[tag[Song]sort[]] :filter[get[year]prefix[198]]">

</$list>
```

I'm just curious if this would be more efficient:


```
<$list filter="[tag[Song]] :filter[get[year]prefix[198]] +[sort[]]">

</list>
```

and if it's enough so that it's even worth considering.  The point is that sorting is at best 
`O(n log(n))`, and filtering should be linear, so if we filter to reduce the list first, we should
have a faster sort call.  Or am I missing something about how filters operate?
Reply all
Reply to author
Forward
0 new messages