Search based on FormTiddlerPlugin data field

25 views
Skip to first unread message

Noltdude

unread,
Jan 6, 2008, 2:27:22 PM1/6/08
to TiddlyWiki
I am using ForEachTiddlerPlugin, DataTiddlerPlugin, FormTiddlerPlugin
attempting to perform a search based on a FormTiddlerPlugin data
field. For example, I would like to have an input field with a button
"search flavor", I type in "chocolate" and it only looks in the
FormTiddler datafield "flavor", not the entire tiddler content. Has
anyone done something like this?

FND

unread,
Jan 6, 2008, 2:52:16 PM1/6/08
to Tiddl...@googlegroups.com
> perform a search based on a FormTiddlerPlugin data field

I'm not very familiar with the FormTiddlersPlugin, but I assume it
simply uses extended fields. In that case, you could use
tiddler.fields[], like so:
---------------
<<forEachTiddler
where 'tiddler.fields["flavor"] == "tasty"'
write 'tiddler.title'
>>
---------------

Another thread with a script making use of FET and extended fields:
http://tinyurl.com/2l5223
(http://groups.google.com/group/TiddlyWiki/browse_thread/thread/6f576fa047a9c1ef/)

HTH.


-- F.

Eric Shulman

unread,
Jan 6, 2008, 3:26:43 PM1/6/08
to TiddlyWiki
> I'm not very familiar with the FormTiddlerPlugin, but I assume it
> simply uses extended fields. In that case, you could use

FormTiddlersPlugin and DataTiddlerPlugin pre-date the existence of
TW's custom tiddler fields, so your assumption is incorrect. Instead
of using tiddler fields, data is embedded directly into the tiddler
body text, in between <data>...</data> markers, and uses the following
plugin-defined functions to set/access the stored values:
DataTiddler.setData(tiddler, field, value, default)
DataTiddler.getData(tiddler, field, default)
DataTiddler.getDataObject(tiddler)
DataTiddler.getDataText(tiddler)

HTH,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Ken Girard

unread,
Jan 6, 2008, 10:56:31 PM1/6/08
to TiddlyWiki
I have something that does what your looking for, except it uses
custom fields, but figure it might give you some help:

<<forEachTiddler where 'tiddler.tags.contains("Training") &&
store.getValue(tiddler,"assignedto") &&
(store.getValue(tiddler,"assignedto").readBracketedList().contains(store.getValue(context.inTiddler,"searchfield")))'
sortBy
'store.getValue(tiddler,"traindate")'
write '"|"+store.getValue(tiddler,"assignedto")
+"|"+store.getValue(tiddler,"traindate")+" |[["+tiddler.title+"]]|\n"'
>>

Then I have this in my EditTemplate:
<div macro="showWhen tiddler.tags.contains('search')">
<br />
<strong>Look for: </strong>&nbsp;<span macro='edit searchfield'> </
span>
<br />
</div>

and this in my ViewTemplate:
<div macro="showWhen tiddler.tags.contains('search')">
<br />
<strong>Look for: </strong> <span macro='view searchfield'> </span>
<br />
</div>

It allows me to find all tiddlers tagged 'Training' that have the same
name in the 'assignedto' field as I put in this tiddlers custom
'search' field.

Ken Girard
Reply all
Reply to author
Forward
0 new messages