FET code

2 views
Skip to first unread message

c.skye

unread,
Aug 30, 2008, 11:12:02 AM8/30/08
to TiddlyWiki
Hi All

trying to get an FT code to work----- I am trying to combine the code
to only pick up the last 10 tiddlers modified, with the code that
writes the first line of the tiddler....

<<forEachTiddler
sortBy
tiddler.modified
descending

write
'(index < 10) ? "* [["+tiddler.title+"]]\n" : ""'>>
----
<<forEachTiddler
where 'tiddler.tags.contains("themes")'
sortBy
tiddler.modified
descending

write
'(index < 10) ? '"|[["+tiddler.title+"]]|"+tiddler.modofier+"|\n":
""'>>

seems I have an extra character...but can´t see or find which?

Skye

Eric Shulman

unread,
Aug 30, 2008, 11:40:12 AM8/30/08
to TiddlyWiki
> <<forEachTiddler
> where 'tiddler.tags.contains("themes")'
> sortBy
>         tiddler.modified
>     descending
>  write
>  '(index < 10) ? '"|[["+tiddler.title+"]]|"+tiddler.modifier+"|\n":
> ""'>>

You have an extra single-quote just after the ? in the following line:
'(index < 10) ? '"|[["+tiddler.title+"]]|"+tiddler.modifier+"|\n":

Note: while FET is very powerful, sometimes it can be easier to just
use plain javascript, like this:

<script>
var out="";
var tids=store.sortTiddlers(store.getTaggedTiddlers("themes"),"-
modified");
for (var t=0; t<tids.length && t<10; t++)
out+="|[["+tids[t].title+"]]|"+tids[t].modifier+"|\n";
return out;
</script>

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

ref: http://www.TiddlyTools.com/#InlineJavascriptPlugin

c.skye

unread,
Aug 30, 2008, 1:23:21 PM8/30/08
to TiddlyWiki
Thanks

that javascript gives me an error message - unterminatd string lateral
- sorry I just don´t know enough javascript to correct it myself...

and...is there a simple, laymans itroduction to javascript that you
can recommend?

Skye

Eric Shulman

unread,
Aug 30, 2008, 1:54:32 PM8/30/08
to TiddlyWiki
> that javascript gives me an error message - unterminatd string lateral
> - sorry I just don´t know enough javascript to correct it myself...

Sorry, GoogleGroups word-wrapped a line containing some quoted text.

This should all be on one line:
---------------
var tids=store.sortTiddlers(store.getTaggedTiddlers("themes"),"-
modified");
---------------


-e

c.skye

unread,
Aug 31, 2008, 9:27:39 AM8/31/08
to TiddlyWiki
Thanks

I should have remembered th google word-wrap problem...not the first
it has created confusion!!!

Skye
Reply all
Reply to author
Forward
0 new messages