How to filter through a template using a field and <$edit-text>?

250 views
Skip to first unread message

leeand00

unread,
Sep 20, 2016, 2:19:54 PM9/20/16
to TiddlyWiki
I figured out how to filter through a list using a field and <$edit-text>, but now I want to do the same thing using a template.

Here is my working non-template example:


Tiddler Title: blah1
\define thisList()

<$list filter="[{!!title}tagging[]$(thefilter)$]">
<ul>
<li><$transclude/></li>
</ul>
</
$list>
\end

<$set name="thefilter" value={{!!dasfilter}}>
<<thisList>>
</$set>

field: dasfilter: tag[blah2]


In another tiddler..and when I type in this the list in blah1
updates to reflect the changes....because of this:

TagFilter <$edit-text tiddler="blah1" field="dasfilter"/>

---

Now I have an existing template and sub template such as follows where I'm trying to do the same thing:

Tiddler Title: meTemplate
Company: <$view field="company"/><br/>:
Title: <$view field="title"/><br/>
Time Period: <$view field="startdate"/>-<$view field="enddate"/> <br/>
Location: <$view field="location"/> <br/>

~TagFilter: <$edit-text tiddler="DutiesFiltered" field="dasfilter"/>

{{!!title||DutiesFiltered}}



Tiddler Title: DutiesFiltered
\define showDuty()
<ul>
<$list filter="[{!!title}tagging[]$(thefilter)$]">
<li><$transclude/></li>
</$list>
</
ul>

\end

<$set name="thefilter" value={{!!dasfilter}}>
<<showDuty>>
</$set>


field: dasfilter: tag[people-skills]

...and then to use both templates I'll use a tiddler like:

Tiddler Title: SeveralOfThese
{{!!title||meTemplate}}
field: company: Someplace
field: enddate: somedate
field: jobtitle: somejob
field: location: someplace
field: startdate: someotherdate

But I don't seem to be able to replicate the functionality of adding tag[sometag]tag[someothertag] to my searchbox so that I can find only the duties I'm looking for in the template / sub template.

Is there some way of doing this?

Thank you,
    Andrew J. Leer

Tobias Beer

unread,
Sep 20, 2016, 3:45:08 PM9/20/16
to tiddl...@googlegroups.com
Hi Andrew,

This:

{{!!title||DutiesFiltered}}

does not work.

Simply use:

{{||DutiesFiltered}}

Best wishes,

Tobias.

leeand00

unread,
Sep 20, 2016, 4:51:47 PM9/20/16
to TiddlyWiki
Okay I fixed that bit...but it still isn't working the way that the first example does...is it because they're all sort-of in the same tiddler?  Am I losing it in scope or something?  Should I attach the field to a different tiddler?

Tobias Beer

unread,
Sep 21, 2016, 6:45:06 AM9/21/16
to tiddl...@googlegroups.com
Hi Andrew,

When you say "template",
do you mean something tagged $:/tags/ViewTemplate
shown at every tiddler, perhaps conditionally?

——

In general, you may want to consider using the StateMechanism,
rather than read and even edit your constraining filter
directly from the tiddler you're looking at.

——

Could you create a Minimal Test Case (MTC) that would:
  • implement your template and filter
  • use meaningful demo tiddlers
  • reproduce the problem with as little data as needed
  • comment on the problem right where it occurs
  • upload that to some public place, or attach to a post here
The thing is, to figure out what may or may not work, anyone willing to help you would have to do just that, while not entirely sure to use the kind of data / setup that won't work in your case.

Best wishes,

Tobias.

leeand00

unread,
Sep 22, 2016, 11:48:29 AM9/22/16
to TiddlyWiki
Alright, so I fleshed it out a little better here in the attached file, and it almost, ALMOST! works. 

The first "Filter Example1" shows how it's supposed to work (kind of)

And the second example "Filter Example2" establishes templates for achieving the same thing, but with the templates it's easily duplicable, so that it can be replicated in other tiddlers easily. 

However the only issue that I'm having is that when I add the "SearchTemplate" as implemented in a tiddler like "Filter Example2", it drops the focus on the $edit-text textbox as soon as you type something, allowing you only to type one character at a time before reselecting it to type another character. 

It makes typing your filter in a real pain.
empty.html

Andrew Daum

unread,
Sep 22, 2016, 2:39:16 PM9/22/16
to tiddl...@googlegroups.com
hey - i'm relatively new to this too, but hopefully here's a part of something helpful :) A.
empty%2520(11).html

Thomas Elmiger

unread,
Sep 22, 2016, 3:10:11 PM9/22/16
to tiddl...@googlegroups.com
Hi Andrew, I think the problem is, that your SearchTemplate changes a field in itself. Try to transclude it in another tiddler, like this maybe:

((Title: Tiddler with Transcluded Search Field))

TagFilter <$edit-text tiddler={{SearchTemplate!!title}} field="dasfilter"/>

EDIT: even shorter

TagFilter <$edit-text tiddler="SearchTemplate" field="dasfilter"/>

This seems to be a common trap as the docs state in the Notes section here: http://tiddlywiki.com/#EditTextWidget – "One trap to be aware of is that the edit text widget cannot be used to edit a field of the tiddler that contains it. Each keypress results in the tiddler being re-rendered, which loses the cursor position within the text field."

Good luck!
Thomas

leeand00

unread,
Sep 22, 2016, 10:22:50 PM9/22/16
to TiddlyWiki
Well one thing that seems to work is to use Vimperator to edit the field, but that's kind of a hack and it doesn't really allow you to see the search results as you type.  But I'll have to give that a try...

Thomas Elmiger

unread,
Sep 23, 2016, 2:41:47 AM9/23/16
to TiddlyWiki
Two things for you to check:
1. I used your case to test my – yet undocumentet – listreveal plugin. Not exactly what you want, maybe too complicated or overkill. But it works.
2. I finished the transclude-in-another-tiddler-approach for you. – This might be close to what you are looking for.

See your data through my tiddlers here: http://tid.li/tw5/test/filterlist.html

leeand00

unread,
Sep 23, 2016, 9:04:44 AM9/23/16
to tiddl...@googlegroups.com

Ah perhaps I was not very clear about what I am trying to do...

What happens is, I have several job position tiddlers, which I am adding to a resume.  My resume is about 8 pages long, and not all of the experience will be considered relevant to each employer.  So what I have decided to do is create a tiddler for each job that I've had using a template that fills in the values of the fields for each employer and they are displayed from the job data template in the job itself.  Each job tiddler is tagged with the tag "job".

Then I have another template I place in each "job" tagged tiddler called "duties filtered";  And this will display the experience line item for each job.  Each experience line item tiddler is tagged with the title of its' "job" tagged tiddler, and a tag for every still that was involved in accomplishing the project or task.

For example, if the job was "Carl's Swedish Fika Cafe", I would have experience items such as "Brewed Coffee", "Scooped Ice Cream", and "Cleaned up".

All of those experience items would be tagged with a "Carl's Swedish Fika Cafe" tag, but only "Brewed Coffee" and "Scooped Ice Cream" would have "food-service" tags.  The "Cleaned up" experience item would have a "janitorial" tag as well as the "Carl's Swedish Fika Cafe" tag.  Also the food-service and janitorial tags are both skills and so they're tiddlers are tagged with a "skill" tag.

Now I want to use this and several other job tiddler instances like it to filter down to only the experience items an employeer might state in their job ad that they are looking for.  And so I place two other things at the top of the tiddler:

1. A distinct list of "skill"s that were involved in each of the experience items within the job tiddler being displaied.
2. A search box to filter through only the experience items below from this particular job based on an "or" type critera data on tags, so that all experience items are displayed for that position.

It looks a bit like this in the end:



But you added a select box which I guess would be a bit better if it were a list box that you could select multiple items from, but I still prefer text input.
Auto Generated Inline Image 1

Jed Carty

unread,
Sep 23, 2016, 9:24:23 AM9/23/16
to TiddlyWiki
This isn't really an answer to your question, but have you seen the resume builder edition? It sounds like you have some nice features that would be good additions to the edition. I am not sure if I am going to have time to add them anytime soon but if you have a working example you wouldn't mind sharing I can look into adding what you have to the edition. (Or if you wanted to help out you could add it and make a pull request.)

Thomas Elmiger

unread,
Sep 23, 2016, 10:25:11 AM9/23/16
to TiddlyWiki
Thanks for explaining, I am still not sure if people receiving your resume would be able to edit a tag filter in a text input …

But you added a select box which I guess would be a bit better if it were a list box that you could select multiple items from, but I still prefer text input.
 
I also fixed your problem with the text input, I hope you noticed the second tiddler on my previous link. Here’s a permalink: http://tid.li/tw5/test/filterlist.html#Transcluded%20Filter

Hope this helps.
 

leeand00

unread,
Sep 25, 2016, 12:39:02 AM9/25/16
to TiddlyWiki
No they don't do it, I read the ad to see what they are looking for and then I filter through it myself, so that it doesn't take me hours or days to throw a resume together and send it in.

And thank you for fixing it!
Reply all
Reply to author
Forward
0 new messages