Hello TW-Community,
is there a way to check the type of a parameter to select the right routine for output?
I have the following situation:
I have Tiddlers with the tag Department
.
AND
I have Tiddlers with fields named Department
containing a name like “Human Resources”.
AND
I want to have Tiddlers with fields named Department
containing a list of Departments e.g. “[[Sales Department] [Purchasing Team]]” but it is not defined how the list has to be created.
I did some tests with different procedures, but I want to have only one procedure what is doing the right output automatically.
My problem here I do not know how to select the right procedure
AND
I also have no idea what kind of definition I can use to define the list in the field and to list these items.
Here is my code so far.
code-body: yes
tags: $:/tags/Global
title: Display the right content
\whitespace trim
\procedure Display (A_Name)
\procedure show_content_of_field(content_selector)
Field <<content_selector>> :
<$view field=<<content_selector>><br>
\end
\procedure show_list(list_selector)
<$list filter='[<list_selector>]' variable="this_field">
<$view field=<<this_field>>/><br>
</$list>
\end
\procedure show_tagged_tiddlers(tag_selector)
<$list filter='[tag<tag_selector>sort[caption]]' variable="title_of_field">
<$view tiddler=<<title_of_field>> field="caption" /><br>
</$list>
\end
<!-- if A_Name is a tag then <<show_tagged_tiddlers A_Name -->
<!-- OR -->
<!-- if A_Name contains a list then <<show_list A_Name -->
<!-- OR -->
<!-- if A_Name contains not a tag and not a list then <<show_tagged_tiddlers A_Name -->
\end
I am curious about the solutions
Stefan