1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-25 11:07:19 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/concepts/DataTiddlers.tid

34 lines
1.3 KiB
Plaintext
Raw Normal View History

2013-08-29 16:49:15 +00:00
created: 201308291647
modified: 201308291647
2014-09-11 14:52:47 +00:00
tags: Concepts
2013-08-29 16:49:15 +00:00
title: DataTiddlers
2014-12-28 09:51:53 +00:00
A data tiddler is a miniature database contained within a tiddler.
2013-08-29 16:49:15 +00:00
2014-12-28 09:51:53 +00:00
There are two standard formats:
2013-08-29 16:49:15 +00:00
2014-12-28 09:51:53 +00:00
* DictionaryTiddlers
* [[JSONTiddlers]]
2013-08-29 16:49:15 +00:00
2014-12-28 09:51:53 +00:00
Other formats of tiddler can also be parsed to yield blocks of data that behave like data tiddlers.
2013-08-29 16:49:15 +00:00
Use a TextReference to look up the value of a named property. For example, if a [[DictionaryTiddler|DictionaryTiddlers]] called `MonthDays` contains:
2013-08-29 16:49:15 +00:00
```
2014-12-28 09:51:53 +00:00
oct:31
nov:30
dec:31
2013-08-29 16:49:15 +00:00
```
2014-12-28 09:51:53 +00:00
... then `{{MonthDays##nov}}` will resolve to the value `30`.
The same is true if `MonthDays` is a [[JSONTiddler|JSONTiddlers]] with the following content:
2013-08-29 16:49:15 +00:00
```
2014-12-28 09:51:53 +00:00
{"oct":31,"nov":30,"dec":31}
2013-08-29 16:49:15 +00:00
```
2014-12-28 09:51:53 +00:00
Note: //It is currently only possible to retrieve data from the immediate properties of the root object of a JSONTiddler.//
The widgets ActionSetFieldWidget and ActionListopsWidget can manipulate named properties of data tiddlers by indicating the name of the property in the $index attribute. To create or modify a named property with ActionSetFieldWidget, provide a $value attribute. To delete a named property with ActionSetFieldWidget, omit the $value attribute. ActionListopsWidget assigns the named property the list constructed through its $filter and $subfilter attributes.