Is there a way to display custom fields without specifying fieldname?

100 views
Skip to first unread message

cmari

unread,
Mar 30, 2009, 10:42:01 AM3/30/09
to TiddlyWiki
Is there a generic way to "show all the custom fields that I've added,
even if I forgot what I called them" for a list of tiddlers (e.g.,
tiddlers tagged with "myTag")?
Ideally, of course, it would be nice to see both the fieldname and
fieldvalue.
thanks!
cmari

ybabel

unread,
Mar 30, 2009, 10:54:23 AM3/30/09
to TiddlyWiki
http://visualtw.ouvaton.org/VisualTW.html
FieldEditorPlugin display all the fields in the toolbar.
But it can also used if you check the code to get to the fields API.

Eric Shulman

unread,
Mar 30, 2009, 11:22:37 AM3/30/09
to TiddlyWiki
> Is there a generic way to "show all the custom fields that I've added,
> even if I forgot what I called them" for a list of tiddlers (e.g.,
> tiddlers tagged with "myTag")?

Try this inline script (requires TiddlyTools' InlineJavascriptPlugin):

<script>
var out=[]; var fmt='| %0|%1|';
var tids=store.getTaggedTiddlers('alpha');
for (var i=0; i<tids.length; i++) {
out.push(tids[i].title);
for (var f in tids[i].fields) out.push(fmt.format([f,tids[i].fields
[f]]));
}
return out.join('\n');
</script>

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

cmari

unread,
Mar 30, 2009, 5:37:38 PM3/30/09
to TiddlyWiki
Thanks to both of you! I had already looked at the
FieldsEditorPlugin, but I'm not clever enough to figure out how to
make it work for an entire list of tiddlers. Eric's script gave me a
fishing pole along with the fish itself (thanks!) and I have also now
learned a bit more about formatting the results of a script. In case
it's useful to anyone else, here's a version that condenses everything
in a table, turns tiddler titles and fieldnames into links, and uses
matchTagsPlugin to be a bit more specific about selecting tiddlers :
<script>
var out=[]; var fmt='[[%0]]: %1|'; var fmt2='\n|[[%0]]|';
var tids=store.sortTiddlers(store.filterTiddlers("[tag[(alpha
AND NOT some tag with spaces)]]"), "modified");
for (var i=0; i<tids.length; i++) {
out.push(fmt2.format([tids[i].title]));
for (var f in tids[i].fields) out.push(fmt.format
([f,tids[i].fields [f]]));
}
return out.join('|');
</script>

cmari

Måns

unread,
Mar 31, 2009, 3:56:59 AM3/31/09
to TiddlyWiki
Hi cmari

I was just looking for a table like that - Thanks a lot for sharing!!

I wonder if one could use {{tiddler.title}} as one of the tags?- I
will test it...
- and maybe even a popup (only when opening the tiddler holding the
script) for choosing tags -
as Eric did in this script *ShowTabsForTags*:
/%
|Name|ShowTabsForTags|
|Source|http://www.TiddlyTools.com/#ShowTabsForTags|
|Version|1.0.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and
[[Creative Commons Attribution-ShareAlike 2.5 License|http://
creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires||
|Overrides||
|Description|automatically generate a tabbed display for tiddlers with
a specified set of tags|

Usage:
<<tiddler ShowTabsForTags with: "tag tag ...">>
where:
"tag tag ..." is a space-separated list of tag values, ALL of which
must be present on the tiddlers that are to be displayed.

%/{{left wrap{<script>
var tags="$1".readBracketedList(); // get tags list from param
if ("$1"=="$"+"1") { // if no tags were specified, then ASK for
tags...
var response=prompt("enter tag(s) to match:","faq");
if (!response) return "no tags specified"; // cancelled by user
var tags=response.readBracketedList();
}
// get tiddlers with a least one matching tag, in date order (newest
first)
// and, for each tiddler that matches ALL tags, add macro params to
output...
var out="";
var tids=store.getTaggedTiddlers(tags[0],'modified').reverse();
for (var t=0; t<tids.length; t++)
if (tids[t].tags.containsAll(tags)) out+='[[%0 ]] "view
%0" [[%0]]'.format([tids[t].title]);
// if any tiddlers matched, output the <<tabs>> macro...
if (out.length) return "<<tabs tabTabsForTags "+out+">>";
// otherwise, output a message with popups for each specified tag...
return "There are no tiddlers tagged with <<tag "+tags.join(">> and
<<tag ")+">>";
</script>}}}

YS Måns Mårtensson

Måns

unread,
Mar 31, 2009, 4:13:32 AM3/31/09
to TiddlyWiki
I tried to use context.viewerTiddler.title and {{tiddler.title}} as
tagdefinitions - but none of them worked.
Any clue??
(store.filterTiddlers("[tag[(context.viewerTiddler.title)]]"),
"modified"); - Doesn't work..

YS Måns Mårtensson

cmari

unread,
Apr 4, 2009, 8:24:27 PM4/4/09
to TiddlyWiki
It should work if you use tiddler.title, for example:
(store.filterTiddlers("[tag[("+tiddler.title+" AND NOT Reference)]]"),

cmari

Måns

unread,
Apr 5, 2009, 8:22:29 PM4/5/09
to TiddlyWiki
It works :-)
Thank you very much!!

YS Måns Mårtensson

Steven Schneider

unread,
Sep 15, 2016, 12:42:50 PM9/15/16
to TiddlyWiki, Tiddl...@googlegroups.com
Reviving an ancient thread to ask the same question in TW5:  I'd first  filter a list of fields in my tiddler, in this case, beginning with 2016, which works perfectly:

<$list filter="[{!!title}fields[]prefix[2016]]">
{{!!title}}<br>
</$list>

Although it is a little weird, each field is treated as a list object, so {{!!title}} and <<currentTiddler>> return the field name, but I can't figure out how to return the field values.

Any thoughts?

Thanks!

//steve.

Tobias Beer

unread,
Sep 15, 2016, 12:52:36 PM9/15/16
to tiddl...@googlegroups.com, Tiddl...@googlegroups.com
Hi Steve,
 
Reviving an ancient thread to ask the same question in TW5:

Please don't. :-)
 
I'd first  filter a list of fields in my tiddler, in this case, beginning with 2016, which works perfectly:

<$list filter="[{!!title}fields[]prefix[2016]]">
{{!!title}}<br>
</$list>

Although it is a little weird, each field is treated as a list object, so {{!!title}} and <<currentTiddler>> return the field name, but I can't figure out how to return the field values.

<$list filter="[{!!title}fields[]prefix[2016]]" variable="field">
<$set name="value" filter="[all[current]get
<field>]">
<$text text=<
<field>>/>: <$text text=<<value>>/><br/>
</$set>
</$list>

Best wishes,

Tobias.

Steven Schneider

unread,
Sep 15, 2016, 1:12:05 PM9/15/16
to TiddlyWiki, Tiddl...@googlegroups.com
OK, i won't revive ancient threads .... I thought that might help folks, but perhaps not.

Your code works perfectly. The key was the "get" operator which I'd never used or even seen before, and including a variable="xx" in the list command. 

Thanks!

On Thursday, September 15, 2016 at 12:52:36 PM UTC-4, Tobias Beer wrote:
Hi Steve,
 
Reviving an ancient thread to ask the same question in TW5:

Please don't.
 
I'd first  filter a list of fields in my tiddler, in this case, beginning with 2016, which works perfectly:

<$list filter="[{!!title}fields[]prefix[2016]]">
{{!!title}}<br>
</$list>

Although it is a little weird, each field is treated as a list object, so {{!!title}} and <<currentTiddler>> return the field name, but I can't figure out how to return the field values.

BJ

unread,
Sep 16, 2016, 10:14:58 AM9/16/16
to TiddlyWiki, Tiddl...@googlegroups.com
one alternative could be

<$list filter="[{!!title}fields[]prefix[2016]]" variable="field">

<<field>> <$view field=<<field>>>
</$list>



all the best
BJ
Reply all
Reply to author
Forward
0 new messages