List array in JSON tiddler.

146 views
Skip to first unread message

Danielo Rodríguez

unread,
Aug 26, 2016, 7:03:44 PM8/26/16
to TiddlyWiki
Hello,

I just wanted to know if it is possible to, having the following tiddler:

MyData
"awesome": [1,2,3,4]
}

Do the following:

<$list filter="[list{MyData##awesome}]">


</$list>


Thanks

Danielo Rodríguez

unread,
Aug 26, 2016, 8:18:56 PM8/26/16
to TiddlyWiki
More questions in this same line:

Is this the only way of getting the values of an array?

<$list filter="[title[MyDataTiddler]indexes[]]">
<$list filter="[title[MyDataTiddler]getindex{!!title}]">

Basically it iterates the properties (0,1,2,n) and then access that property

Tobias Beer

unread,
Aug 27, 2016, 11:47:53 AM8/27/16
to TiddlyWiki
You would need:

title: MyData
type: application/x-tiddler-dictionary

awesome: 1 2 3 4

and then:

<$list filter={{MyData##awesome}}>

<<currentTiddler>>
</$list>

Best wishes,

Tobias.

Tobias Beer

unread,
Aug 27, 2016, 11:49:04 AM8/27/16
to tiddl...@googlegroups.com
Hi Danielo,

I see, what you literally want is to handle the actual (js) array syntax.

You could use my filter tobibeer/split like so:

<$vars array="[1,2,3,4]" p="[" s="]">
<$list filter="[<array>removeprefix<p>removesuffix<s>split[,]]">
<<currentTiddler>><br>
</$list>
</$vars>

Best wishes,

Tobias.

Danielo Rodríguez

unread,
Aug 27, 2016, 2:51:34 PM8/27/16
to TiddlyWiki
Hello Tobias,

You're a tiddlytext magician. I never thought about your first suggestion. That is what I was trying to do, it is not a problem to convert the field to a list in TW format.

I was almost happy with my previous solution, but I feel that now I have to rethink it.

Thank you very much

Reply all
Reply to author
Forward
0 new messages