[tw] Re: List of tiddler conditioned by links in fields
I want to write a list of all the tiddlers tiddlerFive own a part of So essentially, you want a list of tiddlers where either field A or B contain a particular term? The ForEachTiddler plugin should do the job - pseudo code: forEachTiddler where tiddler.fields.owneralpha.contains(tiddlerFive) || tiddler.fields.ownerbeta.contains(tiddlerFive) print * [[ + tiddler.title + ]] HTH. -- F. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlywiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en -~--~~~~--~~--~--~---
[tw] Re: List of tiddler conditioned by links in fields
I want to write a list of all the tiddlers tiddlerFive own a part of (ei tiddlers that link to tidderFive FROM either field owneralpha or ownerbeta (=tiddlerOne and tiddlerTwo)). Without using any plugins at all, you can create a tiddler (e.g., [[ShowList]]), containing: /% !out $1 !end %/tiddler ShowList##out with: {{ var out=[]; var target=$1; var tids=store.getTiddlers(); for (var i=0;itids.length;i++) { var alpha=tids[i].fields.owneralpha; var beta=tids[i].fields.ownerbeta; if (alpha alpha.contains(target) || beta beta.contains(target)) out.push(*[[+tids[i].title+]]); } out.join(\n);}} Then, embed the following in some other tiddler: tiddler ShowList with: TiddlerName e.g. tiddler ShowList with: tiddlerFive Note: to get a list for the *current* tiddler, you can pass it's title, like this: tiddler ShowList with: {{tiddler.title}} enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlywiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en -~--~~~~--~~--~--~---
[tw] Re: List of tiddler conditioned by links in fields
/% !out $1 !end %/tiddler ShowList##out with: {{ var out=[]; var target=$1; var tids=store.getTiddlers(); for (var i=0;itids.length;i++) { var alpha=tids[i].fields.owneralpha; var beta=tids[i].fields.ownerbeta; if (alpha alpha.contains(target) || beta beta.contains(target)) out.push(*[[+tids[i].title+]]);} This works perfectly thank you very much. A new problem, however, arises out of this solution. Let's say I create an additional two custom fields owneralphapercent and ownerbetapercent. And create two tiddlers, percentLinkAlpha and percentLinkBeta in which I put /% !out [[$1|$2]] !end %/tiddler percentLinkAlpha##out with: {{store.getValue('$1','owneralphapercent')}} [[$1]] Futhermore I change the above code to /% !out $1 !end %/tiddler ShowList##out with: {{ var out=[]; var target=$1; var tids=store.getTiddlers(); for (var i=0;itids.length;i++) { var alpha=tids[i].fields.owner3; var beta=tids[i].fields.owner6; if (alpha alpha.contains(target)) out.push(This tiddler own: tiddler percentLinkAlpha with: [[+tids[i].title+]] of [[+tids[i].title+]]); if (beta beta.contains(target)) out.push(This tiddler own: tiddler percentLinkBeta with: [[+tids[i].title+]] of [[+tids[i].title+]]); } out.join(\n);}} Can this be made to work? How do stop the right chevrons () I've added from executing the code prematurely? My goal is to have tiddler ShowList with: tiddlerFive write something like, 'This tiddler own: 75% of tiddlerOne' 'This tiddler own: 66,66% of tiddlerTwo' Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlywiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en -~--~~~~--~~--~--~---
[tw] Re: List of tiddler conditioned by links in fields
out.push(This tiddler own: tiddler percentLinkAlpha with: [[+tids[i].title+]] of [[+tids[i].title+]]); Can this be made to work? How do stop the right chevrons () I've added from executing the code prematurely? As you've noted, the occurrence of within the code interferes with the overall tiddler macro processing. Fortunately, because the is contained within a javascript string, you can avoid the problem simply by putting a \ in between the two characters (e.g., \, like this: out.push(This tiddler own: tiddler percentLinkAlpha with: [[+tids [i].title+]]\ of [[+tids[i].title+]]); Note: a similar problem arises if you attempt to use the 'close CSS wrapper sequence (}}}) within the code, as this interferes with the closing '}}' of the 'eval param' syntax. The same kind of work-around can be used in this case as well: }\}\} -e --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlywiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en -~--~~~~--~~--~--~---