Select Fields by prefix

49 views
Skip to first unread message

Drevarr the Old

unread,
Mar 15, 2020, 6:36:00 PM3/15/20
to TiddlyWiki
Somewhere in here @TonyM provided a method to generate checkboxes based on a data tiddler which I promptly incorporated into a template for creating new tiddlers.  Now instead of having 64 fields, i have a subset depending on what checkboxes are chosen at tiddler creation.

All the fields generated from checkboxes start with the prefix: "act_". The tiddlers have other fields as well that do not start with "act_".

Can someone help walk me through a list filter to select only fields starting with "act_" from the current tiddler and get the field values?

ChristianB

unread,
Mar 15, 2020, 7:34:11 PM3/15/20
to tiddl...@googlegroups.com
Try this as a starting point to list your fields in a table

<table>
<$list variable="fieldName" filter="[fields[]prefix[act_]]" >
<tr>
    <td><<fieldName>></td>
    <td><$view  field=<<fieldName>> /></td>
</tr>
</$list>
</table>

 

TonyM

unread,
Mar 15, 2020, 7:55:12 PM3/15/20
to TiddlyWiki
Drevarr.

Christian got it in one is so far as this finds all fields in the wiki and filters only those with the prefix.

If you use [all[current]fields[]prefix[act_]] then it will only get the current tiddlers fields and the list result in the fieldnames, but you could use other filters like object-type[person]] for all tiddlers containing 

For this reason I would use a variable name as Christian has, so that you can continue to address fields in the currentTiddler

Regards
Tony
Reply all
Reply to author
Forward
0 new messages