The ActionListopsWidget

can be used to add items to a list.

The delete widget can be used to delete tiddlers.

Your outer template (overall template) might look like:

<$vars person=<<currentTiddler>>>
<$list filter=[enlist{!!contacts}] >
{{||contactTemplate}}
</$list>
</$vars>

and the contact template might look like:

<$button> 
<$action-deletetiddler $tiddler=<<currentTiddler>> />
<$action-listops $tiddler=<<person>> $field="contacts" 
$subfilter="+[remove<currentTiddler>]"/> 
Delete <<currentTiddler>> which supports <<person>>
</$button>
Phone: <$edit-text tiddler=<<person>> field="phone1" size=20 tag="input"/> 

Then a button would appear in each contact section allowing you to remove 
that tiddler and remove it's entry in the contact list.

HTH
-- Mark


On Monday, October 29, 2018 at 9:16:22 AM UTC-7, Tristan Kohl wrote:
>
> Thanks, that sounds very promising, I almost made my peace with huge 
> filtering all over the place :/. But how do I get those titles in my list 
> field without overwriting those that are already there? And how do I manage 
> deletion of say Person1-Contact2 which might be somewhere in the middle of 
> that list?
>
> Cheers,
> Tristan 
>
> On Monday, October 29, 2018 at 5:04:48 PM UTC+1, Mark S. wrote:
>>
>> I would avoid complicated structures like JSON, since the tools in TW 
>> won't let you work with them easily.  In most cases, it will be easier to 
>> use other tiddlers as if they formed the related table in a relational 
>> database.
>>
>> I think you want each individual to have multiple contact structures. You 
>> could store these in separate tiddlers. (e.g. Person1-Contact1, 
>> Person1-Contact2). Then have a list field like "contacts" that stores the 
>> name of related contact structures:
>>
>> contacts: [[Person1-Contact1]] [[Person1-Contact2]]
>>
>> You could have a template for each person. And a contact Template. Your 
>> person template would call the contact template:
>>
>> <$edit field="vorname" .... whatever else needs to be edited here ...>
>> <$list filter=[enlist{!!contacts}] >
>> {{||contactTemplate}}
>> </$list>
>>
>> The contact template exposes fields like phone number:
>>
>> Phone: <$edit-text field="phone1" size=20 tag="input"/>
>>
>> Good luck!
>> -- Mark
>>
>> On Monday, October 29, 2018 at 7:45:59 AM UTC-7, Tristan Kohl wrote:
>>>
>>> Hey guys,
>>>
>>> I have an issue with my current project. I am not sure how one would 
>>> tackle this problem so I hope one of you could help me:
>>>
>>> I have a tiddler representing a person which gets rendered through a 
>>> template to display some fields. After creation there are only three 
>>> fields: forename, surname and birthday. However in my template I would like 
>>> to have a edit-text widget by what I would add contact informations to that 
>>> contact. I could create a new tiddler for every phone number, email etc. 
>>> but since those values are tightly coupled to a person I think it would be 
>>> easier to manage if I put those inside the person tiddler as they are no 
>>> longer useful if I delete this person (I would put them in the same table 
>>> in a relational database as well).
>>>
>>> But here comes my current problem into play as I do not know how to 
>>> store an arbitrary amount of contact informations inside a field so I can 
>>> nicely iterate over them in the template for display. My second idea was to 
>>> make the person tiddler a dictionary tiddler and pass it through a template 
>>> upon request but I have no idea how one would do this and if that would 
>>> even be possible.
>>>
>>> *TL;DR;*
>>> How do I store an arbitrary amount of values inside a field (JSON 
>>> maybe?) and how to iterate over them? Is there a better alternative?
>>>
>>

-- 
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/913f929a-a709-4f3e-b2cd-a369cbf9df80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to