On Wednesday, January 6, 2016 at 9:03:22 PM UTC-8, Matabele wrote:
>
> I don't seem to understand the following functions:
> -- getTiddlerData()
> -- setTiddlerData()
> -- extractTiddlerDataItem()
>
> I am trying to:
> -- extract an entry from a data index
> -- convert this data to an array
> -- manipulate the array
> -- then save the modified array back to the data index.
>

Here's what I use:
var data = this.wiki.getTiddlerData("TiddlerTitle",{});
var val = data["index_name"];
// ... your code here.... modify 'val'...
data["index_name"] = val;
this.wiki.setTiddlerData("TiddlerTitle",data); 

The 2nd param in getTiddlerData is a fallback data object (usually empty), 
that is used if the specified tiddler is missing.  The object property 
name/value pairs correspond to the index/value pairs stored in the 
DataTiddler.  To add an index to a tiddler, just assign a value into the 
data array, e.g.,
data["some_new_index_name" = somevalue;

To remove an index from a DataTiddler, set it's value to "undefined" (no 
quotes).
data["some_new_index_name" = undefined;

When the data object is written back to the tiddler, the entire text 
content of the tiddler is overwritten with the name/value pairs from the 
modified object, effectively adding/removing/updating all the individual 
indices at once.

enjoy,
-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/ee64ea99-edd4-4107-8c1e-40e01744ca1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to