TW5: extracting data from data dictionaries

598 views
Skip to first unread message

HowardM

unread,
Sep 12, 2014, 3:02:25 AM9/12/14
to tiddl...@googlegroups.com
I find data dictionaries very useful for storing short pieces of information but am struggling to extract the data except in the simplest way.  In the $list widget I can list, search & sort the indexes to a data tiddler, then display the corresponding values, but cannot find any way of selecting or sorting a display of dictionary entries based on the values.   Is there some way of doing this ?

Alternatively, I understand JSON is a more flexible form for data tiddlers and have looked at the formal definition of these on json.org but I cannot find any explanation of how you can use or display specific content from a JSON using existing widgets, filters etc.   To take $:/HistoryList as an example of a valid JSON structure, if I had a similar structure how would I extract the equivalent of "title", "fromPageRect" etc and how could filters be used on it ?  

Grateful for any advice

Howard

Jeremy Ruston

unread,
Sep 12, 2014, 4:45:56 AM9/12/14
to TiddlyWiki
Hi HowardM

As you've found, the current support for using data tiddlers and JSON tiddlers from wikitext is limited to accessing and enumerating the top level properties. That was enough to meet the needs of the core UI. The plan eventually is to improve support so that arbitrary indexes can be accessed.

Best wishes

Jeremy

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Stuart Amor

unread,
Jun 10, 2016, 2:48:55 AM6/10/16
to TiddlyWiki, jeremy...@gmail.com
Has anybody develop a hack for this? My data tiddlers look like this:

Sink: 1
Taps: 1
Toilet: 0

I would like to create a list of all the Index values, but only the ones that have a value of "1"

BJ

unread,
Jun 10, 2016, 12:13:14 PM6/10/16
to TiddlyWiki, jeremy...@gmail.com
Hi Stuart,

this is based on similar one for fields by  Jeremy

\define inner(tid,indexName,match)
<$set name="v" value={{$tid$##$indexName$}}>
<$list filter="[<v>regexp[^$match$$]]" variable="x">
<$text text="""$indexName$"""/>
</$list>
</$set>
\end

\define matchvals(tid,match)
<$set name="t" value=$tid$>
<$list filter="[<t>indexes[]sort[]]" variable="indexName">
<$macrocall $name="inner" tid=<<t>> indexName=<<indexName>> match=$match$/>
</$list>
</$set>
\end
<<matchvals datatid 0>>

all the best

BJ
Reply all
Reply to author
Forward
0 new messages