Hi,
I'm trying to have multiple fields whose content is an array, and I need
help on how to manipulate them.
Let's have a tiddler about a person (tiddler) *Alfred*, having *Burt,
Connie, Danny* as relatives.
The relationship of B,C,D to A is respectively: *son, wife, brother*.
So I would like to use two fields: '*relatives*' and '*role*' to describe
the situation. Note that 'role' is not absolute, but limited to Alfred.
I would build two arrays as fields:
*relatives*: '*Burt Connie Danny*' and
*roles*: '*son wife brother*';
There is more than one question about:
1. can I put a separator like any array, so that I'm able to separate
items or I'm forced to use a space as separator? Otherwise I will never be
able to insert double names, as 'Mary Ann'. Or there's an escaping
character, as '\'.
2. can I refer to a single name as element of the array? Something link
{{ !!relatives[2] }} or {{ !!roles[1] }}. I've tried widgets like <$list>
and <$view> but I don't know how to address single fields. Or maybe assign
the field to a variable and access the variable (...how?)
I tried also to write a table associating relatives and roles and also that
was not so easy (I used a technique from stephenteacher.tiddlyspot.com
<http://stephenteacher.tiddlyspot.com/#Force>):
<table>
<tr><th>relatives</th><$list filter="[list[!!relatives]]" >
<td><$transclude field="title"/></td>
</$list></tr>
<tr><th>roles</th><$list filter="[list[!!roles]]" >
<td><$transclude field="title"/></td>
</$list></tr>
</table>
This works (because the list commands are independent each other as they
are on different rows), but I wanted list the elements by rows, not by
columns, so if I should do something like:
<table>
<tr><th>relatives</th><th>roles</th></tr>
<$list filter="[list[!!relatives]]">
</tr>
<td><$transclude field="title"/></td>
<td><$transclude field="roles field of Alfred tiddler"/></td>
</tr>
</$list>
</table>
I understand that list assumes a list of tiddlers (not generic arrays) as
input, so uses title field of non existing relatives tiddlers
Is there another more 'trivial' technique as for arrays, like:
<table>
<tr><th>relatives</th><th>roles</th></tr>
<$for index="i=1:length(relatives)">
</tr>
<td><$view field="relatives[i]"/></td>
<td><$view field="roles[i]"/></td>
</tr>
</$list>
</table>
Any suggestion is welcome...
Thanks and regards,
Netsaver, Rome (IT)
--
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/6ee0709a-0d39-4813-b821-7e31ec8fe328%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.