Populating the list field with selected tiddlers

Folks,

I have a cheat sheet tiddler, I want it to transclude all the tiddlers in its list field for quick reference.

Can anyone suggest best the code to find/search/select from all tiddlers to add tiddlers to the list field?

There are so many ways this may be achieved, I expect someone has given it a lot of thought already and may have an “efficient and preferred method”.

I sometimes forget to ask or search for a useful solution and often build it myself, so I thought I would ask this time.

Anyone?

Basically I am after any previous work that allows a user to easily select tiddlers via search or other easy to use interactive methods and add these to the list field.

I have something really basic at work I use for meeting attendees. I’ll get it in the morning if I don’t see a better answer here.

1 Like

So I hope I understood the question, but it’s around the finding / populating of the list, not the transcluding bit… If that’s right, it sounds like what I do for marking down who attends the meetings I’m in for notes purposes. Like the below where I expand an area out for a search-box that shows the first 10 contact matches, and with a button, adds them to a list field.

attendees

Here it is raw - plenty to strip out that do more than you need.

Attendees:
<$list filter="[all[current]enlist{!!attendees}]" variable="attendee">
<$link to=<<attendee>> tooltip={{{ [<attendee>get[jobtitle]] }}}><<attendee>></$link>&nbsp;
<$button class="tc-btn-invisible tc-tiddlylink">✖<$action-listops $field="attendees" $subfilter="-[<attendee>]"/></$button>, 
</$list>
<$list filter="[{$:/temp/add-attendees!!meeting}!match<currentTiddler>]" variable="x">
<$button class="tc-btn-invisible tc-tiddlylink">▶<$action-setfield $tiddler="$:/temp/add-attendees" $field="meeting" $value=<<currentTiddler>>/></$button>
</$list>
<$list filter="[{$:/temp/add-attendees!!meeting}match<currentTiddler>]" variable="x">
<$button class="tc-btn-invisible tc-tiddlylink">◀<$action-deletetiddler $tiddler="$:/temp/add-attendees" /></$button><br>
Add: <$edit-text tiddler="$:/temp/add-attendees" tag="input" size="20" default="" focus="true"/>
<$list filter="[{$:/temp/add-attendees}minlength[2]]" variable="x">
<$list filter="[tag[Contacts]search:title{$:/temp/add-attendees}first[10]]" variable="contact">
<$link to=<<contact>>/>&nbsp;
<$button class="tc-btn-invisible tc-tiddlylink">✚<$action-listops $field="attendees" $subfilter="[<contact>]"/><$action-setfield $tiddler="$:/temp/add-attendees" $value=""/></$button>,
</$list>
</$list>
</$list>

Some things I’ll eventually get around to adding would be:

  1. A way to re-focus the edit-text after adding
  2. Keyboard shortcut to add the first returned result

Hope that’s helpful,

1 Like

Decided to just finish it up - added a <$keyboard/> that accomplished the last 2 things I mentioned. Now the enter key will add the first result and clear the box for more searching.

\define add-first() <$action-listops $field="attendees" $subfilter="[tag[Contacts]search:title{$:/temp/add-attendees}first[1]]"/><$action-setfield $tiddler="$:/temp/add-attendees" $value=""/>

Attendees:
<$list filter="[all[current]enlist{!!attendees}]" variable="attendee">
<$link to=<<attendee>> tooltip={{{ [<attendee>get[jobtitle]] }}}><<attendee>></$link>&nbsp;
<$button class="tc-btn-invisible tc-tiddlylink">✖<$action-listops $field="attendees" $subfilter="-[<attendee>]"/></$button>, 
</$list>
<$list filter="[{$:/temp/add-attendees!!meeting}!match<currentTiddler>]" variable="x">
<$button class="tc-btn-invisible tc-tiddlylink">▶<$action-setfield $tiddler="$:/temp/add-attendees" $field="meeting" $value=<<currentTiddler>>/></$button>
</$list>
<$list filter="[{$:/temp/add-attendees!!meeting}match<currentTiddler>]" variable="x">
<$button class="tc-btn-invisible tc-tiddlylink">◀<$action-deletetiddler $tiddler="$:/temp/add-attendees" /></$button><br>
Add: <$keyboard key="enter" actions=<<add-first>>><$edit-text tiddler="$:/temp/add-attendees" tag="input" size="20" default="" focus="true"/></$keyboard>
<$list filter="[{$:/temp/add-attendees}minlength[2]]" variable="x">
<$list filter="[tag[Contacts]search:title{$:/temp/add-attendees}first[10]]" variable="contact">
<$link to=<<contact>>/>&nbsp;
<$button class="tc-btn-invisible tc-tiddlylink">✚<$action-listops $field="attendees" $subfilter="[<contact>]"/><$action-setfield $tiddler="$:/temp/add-attendees" $value=""/></$button>,
</$list>
</$list>
</$list>
2 Likes

Thanks I will test tomorrow,

By the way I am about to build a solution for a rolling agenda, minutes and tasks for a community group/project team.

@stobot this will certainly help in some cases, you are staring with a subset of tiddlers, possible attendees, I am interested in providing the tools to rapidly find any tiddler in a large wiki. I wonder if the volume of possible tiddlers to select from presents the need for a different approach. I need to give it some thought.

Gotcha, that might be true. If your concern is performance though, I’d say that the combination of minlength on the search string and a limit[x] on the results side works really well for me in large wikis elsewhere.

1 Like

Yes, I suppose I could allow a 10 20 or 30 + items limit option.

Or - wrap a larger list with columns with the navigator widget detecting which I choose.

Thanks for the suggestions

@stobot This was very useful. Thanks.

I have used it by replacing ‘attendees’ with ‘participants’ and ‘Contacts’ with ‘Contact’ to meet my needs.

But as I was doing that, I thought it would be great to define a macro that will accept two inputs — targetfield and sourcetag. Then, we will have a generic solution.

I could not bring my code to work. :frowning: I had added:

\define AutoCompleteFieldFromTag(field, tag)

at the top and replaced relevant bits with $field$ and $tag$.

Any suggestions to get this working?