On Thursday, June 7, 2018 at 9:34:01 PM UTC+7, Diego Mesa wrote:
>
> Hello all,
>
>
> Does anyone have any better ideas/systems for managing this?
>
>
>
After lurking for over a year, this is my first time posting here.
This was the exact issue I had as well.
A few hundred cases of tiddlers related to each other.
Often starting with just 2 related tiddlers, but then adding in 2 or 3 more
related tiddlers.
I decided to write a macro, to save time, but as importantly, to avoid
mistakes when editing 4 or 5 tiddlers to put in the right related lists.
On laying out the logic I thought it would be quite simple.
It should have been, but my lack of skill coupled with TW's delightfully
fickle handling of variables made it much more difficult for me that I
first imagined.
*THE LOGIC I USED*
for macro - <<related>>
creates a button which updates related tiddlers' field: *related*
List of related tiddlers W X Y
Add a new related tiddler: Z
Editing NEW Tiddler Z - give field: *related* - value: [[W]] [[X]] [[Y]]
Set Variables: TT , RL
Derived Variables: FL , WT , PL
TT = This Tiddler - Z = {{!!draft.title}}
RL = Related Tiddlers = {{!!related}}
FL = Full List - [[W]] [[X]] [[Y]] [[Z]] // made from RL + TT
WT = Working Tiddler ( $list RL )
PL = Partial List ( FL minus WT {to put in related field of WT} )
$List RL - output = ? ( W , X , Y ) into variable WT
1st item ? is W
$action-setfield $tid=W field:related= X Y Z
2nd item ? is X
$action-setfield $tid=X field:related= W Y Z
3rd item ? is Y
$action-setfield $tid=X field:related= X W Z
List End RL
The macro I use is named: *<<related>>*
This is in a tiddler with a tag: *$:/tags/Macro*
A New tiddler that is being created should have a field: *related*
The related field should have one or more tiddlers in a list - ex. : [[tid
1]] [[tid2]] [etc.]]
The macro *<<related>>* is put at the bottom of the New tiddler being
created, and a *button* is visible only when that tiddler is in Draft mode.
The new name of this tiddler should be entered (*title*) before using the
button.
\define set-field(PL) <$action-setfield $tiddler="$(WT)$" $field ="related"
$value="$(PL)$">
\define related()
<$list filter="[has[draft.of]]">
<$set name =TT value={{!!draft.title}}>
<$set name =RL value={{!!related}}>
<$set name=FL filter="[enlist<RL>][<TT>]">
<$button>
<$list filter="[enlist<RL>]" variable="WT">
<$set name=PL filter="[enlist<FL>]-[<WT>]">
<$macrocall $name="set-field"/>
</$set>
</$list>
Set Related Tiddlers<br>
as shown below:<br>
</$button>
<$list filter="[enlist<RL>]" variable="WT">
<$set name=PL filter="[enlist<FL>]-[<WT>]">
Tid: <<WT>> - Set Related: <<PL>>
</$set></$list></$set></$set></$set></$list>
\end
Hope it helps.
The accompanying <<related-footer>> macro is comparatively trivial - but I
will include it for other beginners like myself.
When used in a tiddler, it displays a (one line) list of the tiddlers in
that tiddler's *related *field.
\define related-footer()
<h5><$list filter=[all[current]has[related]]>
//Related// |
<$list filter=[all[current]list[!!related]] variable="name">
<$set name="tv-wikilink-tooltip" value="{{!!title}} - {{!!description}}">
<$link to=<<name>> > <<name>>
</$link> |
</$set>
</$list></$list></h5>
\end
As I mentioned at the beginning of this post, this is my first time on the
list (in fact, first time posting on Google Groups) - so if there are any
mistakes in my posting - please bear with me.
Cheers.
--
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/3a7c1040-055e-4b19-b56f-536220212745%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.