I’m building a method to link two tiddlers by creating a third one, in this case for a gift ideas notebook:
title: John
tags: person
title: Bicycle
tags: gift
title: Umbrella
tags: gift
title: Link1
tags: link todo
link-person: John
link-gift: Bicycle
title: Link2
tags: link done
link-person: John
link-gift: Umbrella
According with the above, I’m planning to get John a bicycle (todo) and I’ve already given him an umbrella (done).
On each person I’ll list all available gifts in a dropdown and I’ll display two buttons, To Gift and Already Gifted. Each will run a procedure (create-link-person-gift()) to create the appropriate new link tiddler similar to the above and clear the currently selected entry from the dropdown.
I’ve been thinking of two possible approaches:
- Define the whole procedure in a
$:/tags/ViewTemplate, insert it into everypersonand access{{!!title}}and{{!!selected-gift}}relatively easily. - Define the procedure in a separate tiddler tagged
$:/tags/Globaland call it from eachpersonby passing as a parameter<<currentTiddler>>to set the correct context (inspired by @EricShulman’s comment) before accessing the two required fields.
I’m still struggling a bit with the appropriate syntax for passing parameters, but which of the above two do you think would be preferable? I’m leaning towards the former as it seems simpler, but I’m a bit worried it might create a lot of overhead if a lot of persons are open? For example, what would happen if I feed the above into TW5-Graph and a lot of them are displayed at the same time?
