Create a list of data-dictionary tiddlers that contain a certain text field

231 views
Skip to first unread message

Stuart Amor

unread,
Mar 31, 2016, 4:56:26 AM3/31/16
to TiddlyWiki
I have created several hidden Data-dictionary tiddlers all containing the same information but referring to a different entity.  For example, I have a tiddler called "$:/data/Bathroom", that contains the following:

Sink:X
Toilet:X

I also have a Data-Dictionary called "$:/data/Kitchen" that simply contains:

Sink:X

I would like to create a list within the "Sink" tiddler that identifies the Data-Dictionaries that have a sink entry.  If I could remove the "$:/data/" portion of the linked tiddler title at the same time that would be great, so the link would report:
  • Bathroom
  • Kitchen
I have done a google groups search and haven't found any code that reflects this idea, would really appreciate some help

Mat

unread,
Mar 31, 2016, 10:54:28 AM3/31/16
to TiddlyWiki
Hi Stuart, this is at least a step on the way;

<$list filter="[is[system]!title<currentTiddler>regexp:text[^sink]removeprefix[$:/data/]]"/>

You can snoop around in the docs for the various Filter Operators.

<:-)
Message has been deleted

c pa

unread,
Mar 31, 2016, 1:20:50 PM3/31/16
to TiddlyWiki
OK first you should be using application/json tiddlers rater than Data-dictionary tiddlers because you are defining the same variable with different values in 2 different places
The easiest solution is to use the room name instead of X and just return the room names

title: $:/data/Kitchen
text:
{
"Sink":"Kitchen",
"Refrigerator":"Kitchen"
}
Type: application/json

title: $:/data/Bathroom
text:
{
"Sink":"Bathroom",
"Toilet":"Bathroom"
}
Type: application/json

title: Sink
text:
<$list filter="[getindex<currentTiddler>]">

</$list>

Stuart Amor

unread,
Apr 1, 2016, 2:14:09 AM4/1/16
to TiddlyWiki
C Pa, that is a great solution and works well - thank you. However, removing the X breaks a matrix table that listed the locations as column headers and the items as row headers with an "X" if it existed or a "-" if it didn't. How would I modify my

<$transclude tiddler=<<col>> index=<<row>>>-</$transclude>

To give me an "X" instead of repeating the room name?

c pa

unread,
Apr 1, 2016, 1:55:41 PM4/1/16
to TiddlyWiki
Put an X in the list like this:

<$list filter="[getindex<currentTiddler>]">
    X
</$list>

Stuart Amor

unread,
Jun 9, 2016, 2:19:38 AM6/9/16
to TiddlyWiki
Ok, I think I was guilty of making the solution to my ask too hard. I realised that a simple search filter would work and the fact the tiddlers that I was searching through were data tiddlers didn't matter.


<$list filter="[is[system]] [is[shadow]] +[search[Door Lock]] +[remove prefix[$:/data/]sort[list]]"/>

Was all I needed todo. However, I have now expanded my code following the resent checkboxes within data tiddlers article, which switches thinks to Json and can include 0 values as well as "1", I now need to search for ["Door Lock": "1"]. When I enter this phrase into the sidebar system search I get the correct result, but the follow script is not working for me:

<$list filter="[is[system]] [is[shadow]] +[search["Door Look": "1"]] +[remove prefix[$:/data/]sort[list]]"/>

I am guessing this is because I have a search term that includes quotes, but I need to search for that exact phrase. The sidebar demonstrates it can be done, but how is it done?

BJ

unread,
Jun 9, 2016, 5:06:38 AM6/9/16
to TiddlyWiki
Hi Stuart,
try

<$list filter="""[is[system]] [is[shadow]] +[search["Door Look": "1"]] +[remove prefix[$:/data/]sort[list]]"""/>

all the best
BJ

Stuart Amor

unread,
Jun 10, 2016, 1:17:17 AM6/10/16
to TiddlyWiki

Thank you, that did the trick

Reply all
Reply to author
Forward
0 new messages