Filtering a list of skills and skill categories to just the skills in the list.

83 views
Skip to first unread message

leeand00

unread,
Nov 10, 2016, 1:04:46 PM11/10/16
to TiddlyWiki
Using the macro below I get the following text when I set the field "jobitemsskilltags" to "[title[sql]][title[windows-7]]"

  • programming-lang
    • sql
    • windows-7
  • os
    • sql
    • windows-7
It works pretty good..but I'd like only the titles of skills tagged with os to show up under os...and only the skills tagged with programming-lang to show up under programming-lang for instance:

  • programming-lang
    • sql
  • os
    • windows-7


\define showSkillParent()
$
(dasSkillsCompanyIsLookingFor)$
<hr/>
$
(dasJobItemSkillsTags)$<br/>
[title[sql]][title[windows-7]]

       
<ul>
         
<!-- BEGIN: Get a list of skill-categories. -->
         
<$list filter="$(dasJobItemSkillsTags)$+[tags[]tag[skill-cat]]+[tagging[]]+[tags[]tag[skill-cat]]">
             
<li><$view field="title"/>
                   
<ul>
                           
<$list filter="$(dasJobItemSkillsTags)$+[tags[]tag[skill-cat]]+[tagging[]]+[tags[]tag[skill-cat]]+$(dasJobItemSkillsTags)$">
                           
<li>
                                 
<$view field="title"/>
                           
</li>
                           </
$list>
                   
</ul>
             </
li>
         
</$list>
         <!-- END: Get a list of skill-categories. -->
    </
ul>
\end



<$vars dasJobItemSkillsTags={{!!jobitemsskilltags}} dasSkillsCompanyIsLookingFor={{!!skillscompanyislookingforfilter}}>
<<showSkillParent>>
</$vars>



I think this has something to do with the nested $list's filter which reads:
"$(dasJobItemSkillsTags)$+[tags[]tag[skill-cat]]+[tagging[]]+[tags[]tag[skill-cat]]+$(dasJobItemSkillsTags)$"

but I'm not sure how to filter it down to JUST the skills that are in that category.

P.S. And yes, I am aware of the TOC macro thank you.

Thank you,
    Andrew J. Leer

Mark S.

unread,
Nov 10, 2016, 1:46:00 PM11/10/16
to TiddlyWiki
I don't understand what's supposed to be going on in your filters. They seem to be complicated and I couldn't get them to work without your data. Since I don't have access to your sample data tiddlers, I guessed at what was needed. Here is my simplified version, which I generated with 2 tiddlers, sql & windows-7:

\define showSkillParent()
$
(dasSkillsCompanyIsLookingFor)$
<hr/>
$
(dasJobItemSkillsTags)$<br/>



       
<ul>

         
<!-- BEGIN: Get a list of skill-categories. -->
         
<$list filter="$(dasJobItemSkillsTags)$">

             
<li><$view field="title"/>
                   
<ul>

                           
<$list filter="[tag<currentTiddler>]">

                           
<li>
                                 
<$view field="title"/>
                           
</li>
                           </
$list>
                   
</ul>
             </
li>
         
</$list>
         <!-- END: Get a list of skill-categories. -->
    </
ul>
\end


The main functional change was in the second list, where I used "[tag<currentTiddler>]" to just bring in items tagged according to the first (outer) list.

HTH
Mark

leeand00

unread,
Nov 10, 2016, 2:26:57 PM11/10/16
to tiddl...@googlegroups.com
Alright, let me try this again..

So to be clear:
  • The "os" and "programming-lang" tiddlers are tagged with the "skill-cat" tag.
  • The "windows-7" and "sql" tiddlers are tagged with the "skill" tag.
  • The "windows-7" tiddler is tagged with the "os" tag.
  • The "sql" tiddler is tagged with the "programming-lang" tag.
So then in the meantime...I came up with something here that works correctly, but it's too complicated:

\define showSkillParent()


       
<ul>
         
<!-- BEGIN: Get a list of skill-categories. -->
         
<$list filter="$(dasJobItemSkillsTags)$+[tags[]tag[skill-cat]]+[tagging[]]+[tags[]tag[skill-cat]]">
             
<li><$view field="title"/>
                  <$set name="dasTitle" value={{!!title}}>
                  <<showParentChildren>>
                  </
$set>

             
</li>
         </
$list>
         
<!-- END: Get a list of skill-categories. -->
   
<
/ul>
\end

\define showParentChildren()
<ul>

<$list filter="[title[$(dasTitle)$]]+[tagging[]]-$(dasJobItemSkillTagsNot)$">

   <li><$view field="title"/
></li>
</$list>


</
ul>
\end


<$vars dasJobItemSkillsTags={{!!jobitemsskilltags}} dasJobItemSkillTagsNot={{!!jobitemskilltagsnot}}>
<<showSkillParent>>
</$vars>

The only problem with it is, that I have to generate two sets of fields with generally the same skill values in them....

The first one (dasJobItemSkillsTags) is used to determine which parent skill-categories are involved...via:

\define showSkillParent()


       
<ul>
         
<!-- BEGIN: Get a list of skill-categories. -->
         
<$list filter="$(dasJobItemSkillsTags)$+[tags[]tag[skill-cat]]+[tagging[]]+[tags[]tag[skill-cat]]">
             
<li><$view field="title"/>

                 
<$set name="dasTitle" value={{!!title}}>
                 
<<showParentChildren>>
                 
</$set>
             </
li>

         
</$list>
         <!-- END: Get a list of skill-categories. -->
    </
ul>
\end



The second one (dasJobItemSkillTagsNot) removes any of the non-matched skills from the list...via:

\define showParentChildren()
<ul>

<$list filter="[title[$(dasTitle)$]]+[tagging[]]-$(dasJobItemSkillTagsNot)$">

   
<li><$view field="title"/></li>
</$list>


</
ul>
\end


but on the whole they're a list of the same skills..so it would be nice to be able to generate them inputing just one list somehow...for example:

dasJobItemSkillTagsNot: [!title[windows-7]!title[sql]]
dasJobItemSkillsTags: [title[sql]][title[windows-7]]

by inputting something like "windows-7, sql"

Does that make more sense?  I hope so.

Mark S.

unread,
Nov 10, 2016, 3:09:35 PM11/10/16
to TiddlyWiki
I'm confused about your objectives. You mention only four tiddlers. So, what are the contents of "jobitemskilltagsnot" ?

leeand00

unread,
Nov 10, 2016, 3:26:15 PM11/10/16
to tiddl...@googlegroups.com
Well in actuality there are alot more tiddlers both categories and skills.

dasJobItemSkillTagsNot is the contents of jobitemsskilltagsnot.

My objective is to input a set of skills that I've used to filter a list of experience, and then use the same list of skills to generate a list of skills and which categories they are in.

Mark S.

unread,
Nov 10, 2016, 3:31:46 PM11/10/16
to tiddl...@googlegroups.com
Edit: Ignore this post and go to my next one.

Ok, this code here seems to do exactly what you want and is simpler. Explain what it's not doing that you wanted in addition:

\define showSkillParent()
       
<ul>
         
<!-- BEGIN: Get a list of skill-categories. -->

         
<$list filter="[tag[skill-cat]]">

             
<li><$view field="title"/>

                 
<<showParentChildren>>
                 
             
</li>
         </
$list>
     
</ul>
\end

\define showParentChildren()

<ul>

<$list filter="[tag<currentTiddler>]">
   <li><$view field="title"/
></li>
</$list>
</
ul>
\end


<<showSkillParent>>


 Good luck!
Mark


On Thursday, November 10, 2016 at 12:26:15 PM UTC-8, leeand00 wrote:
Well in actuality there are alot more tiddlers both categories and skills.


dasJobItemSkillTagsNot is the contents of jobitemsskilltagsnot.

Mark S.

unread,
Nov 10, 2016, 10:52:08 PM11/10/16
to TiddlyWiki
Ok, I think I understand what you want.

You have some tiddlers that are categories of skills (OS, programming). You have other tiddlers that are tagged with the categories and that ARE the possible skills. You want a macro where you can pass a list of skills and get back a listing by category of those same skills. BUT you only want to see the categories that those skills use (not the unused categories).

I've attached a JSON with the sample data I used and a tiddler (skillsfilter2). Inside the tiddler, I call

<<showSkillParent "windows-7 linux-admin" >>

and get back:

os
                 
  • windows-7
  • linux-admin

Only "os" shows up, because only "os" is used by the items I passed.

If I invoke:

<<showSkillParent "windows-7 sql" >>

Then the output is :

  • os
                     
    • windows-7
  • programming-lang
                     
    • sql


Here both "os" and "programming-lang" show up because both are required. The compromise is that you can't use any skills names with spaces in them. But it didn't seem like you were using spaces anyways.

HTH,
Mark



On Thursday, November 10, 2016 at 12:26:15 PM UTC-8, leeand00 wrote:
SkillManager.json

leeand00

unread,
Nov 11, 2016, 3:26:23 PM11/11/16
to TiddlyWiki
Right, it's more like a search that fills a 2 layer tree in, sorry if I wasn't clear about that...Hey thanks!  I really appreciate it! 
Reply all
Reply to author
Forward
0 new messages