Ah, exploiting the fact that the length of the array is the next index -
nice trick! Thanks, Joshua - that should work nicely.
On Wednesday, November 29, 2017 at 12:21:29 PM UTC-6, Joshua Fontany wrote:
>
> If the JSON tiddler is a flat array:
> [ .... ]
> not
> { ... }
> then zero-based numerals function fine for the index.
>
> Button to add the content of [[$:/temp/newIndex]] to the JSON tiddler
> defined in {{$:/temp/newIndex!!parent}}:
>
> <$set name="i" filter="[{$:/temp/newIndex!!parent}indexes[]count[]]">
> <$button><$action-setfield $tiddler={{$:/temp/newIndex!!parent}} $index=<<i>>
> $value={{$:/temp/newIndex!!text}} />
> Add Index
> </$button>
> </$set>
>
> Tested on Tiddlywiki.com, works fine with both JSON tiddler types. If the
> Json tiddler starts empty it will be started as an object {"0":"test"}, but
> if it is aready setup as an array, a new index will just be appended:
> ["test"] -> ["test,"test"]
>
> Best,
> Joshua Fontany
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/dc5ffd1c-52de-4325-be3b-bebd30ef8fac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.