Hi all,
All relevant tiddlers are tagged with tid
and contain the field veld
.
The content of veld
can vary as shown in the following table.
The for me interesting codes are the ones starting with a character followed by a 3-digit number (bold in the table below).
Tiddler | Content of veld |
---|---|
tiddler1 | C804, A878 |
tiddler2 | G16, 1945- J5, 1947- JT5, 1950- D806 |
tiddler3 | M832 |
tiddler4 | C801 |
tiddler5 | D 20, 1946- KL1, 1947- KV1, 1950- C803, A879 |
tiddler6 | J6, 1947- JT6, 1950- D804, 1958- F812 |
tiddler7 | P336, 1946- O2, 1948- O28, S812 |
tiddler8 | |
tiddler9 | FY54, 1946- MV7, 1950- M863 |
tiddler10 | A835 |
… | |
… |
Cxyz
(C followed by a 3-digit number)Cxyz
, Name of tiddler, Content of veld
Cxyz | Name of tiddler | Content of veld |
---|---|---|
C801 | tiddler4 | C801 |
C803 | tiddler5 | D 20, 1946- KL1, 1947- KV1, 1950- C803, A879 |
C804 | tiddler1 | C804, A878 |
With [regexp:veld[C\d\d\d]]
I can filter all tiddlers containing Cxyz
.
Result - as given in Advanced search, tab Filter:
tiddler1
tiddler4
tiddler5
which means this are the 3 tiddlers containing a Cxyz
code.
xyz
)\define xyz()
???
\end
\define llinks(filter)
<$list filter="$filter$">
<tr>
<td>
<<xyz>>
</td>
<td>
<$link to={{!!title}}>
<$view field="title"/>
</$link>
</td>
<td>
<$view field="veld"/>
</td>
</tr>
</$list>
\end
<table>
<tr>
<th>Cxyz</th>
<th>Name of tiddler</th>
<th>Content of `veld`</th>
</tr>
<<llinks "[tag[tid]] +[regexp:veld[C\d\d\d]]">>
</table>
renders as:
Cxyz | Name of tiddler | Content of veld |
---|---|---|
??? | tiddler1 | C804, A878 |
??? | tiddler4 | C801 |
??? | tiddler5 | D 20, 1946- KL1, 1947- KV1, 1950- C803, A879 |
Column 1 contains ???
caused by missing helper macro.
How to create this helper macro which needs to:
Cxyz
part from the field veld
and store it in a tiddler / field / variable so it can be transcluded into column 1 of the tableMTC with the information given here, see http://tw5tongerner.tiddlyspot.com/
Help would be greatly appreciated!
Cheers,
Ton
<table>
<$list filter="[has[veld]regexps:veld[(C\d\d\d)]sort[]]" variable="code">
<$list filter="[search:veld<code>]">
<tr>
<td>
<<code>>
</td>
<td>
<$link to={{!!title}}>
<$view field="title"/>
</$link>
</td>
<td>
<$view field="veld"/>
</td>
</tr>
</$list>
</$list>
</table>
An awful job?
An awful job?
I can tell you how to fix it, but you may not like it. The pieces of text that are currently split off into "titles" do not represent tiddlers (at least not in your sample TW). But many of the filter operators want to work on real tiddlers.
There is an operator that can make sure that only one of each code is represented in the outer layer. It is the "each" filter operator. So the outer filter code would look like:<$list filter="[has[veld]regexps:veld[(C\d\d\d)]each[]sort[]]" variable="code">BUT -- for this to work, each of the codes has to have a real-world tiddler. That is, you need to make a C801, C803, C804 etc. tiddler in order for the each operator to work on the result of the regexps. Of course, there are ways to make these very quickly. The only question is whether you mind having your space littered with the extra tiddlers.
I was looking at the each code to see if I could make an "each string" macro. It turns out that there is an undocumented feature in the each filter. A list like this:<$list filter="[has[veld]regexps:veld[(C\d\d\d)]each:value[title]sort[]]" variable="code">May do what you want without having to create those extra tiddlers.
\define list-all-codes()<$set name="f" filter="""[has[veld]get[veld]]"""><$wikify name="ac" text=<<f>>><$list filter="""[enlist<ac>!suffix[,]] [enlist<ac>removesuffix[,]] +[sort[]]""" variable="c"><<c>></$list></$wikify></$set>\end
\define get-codes-by-prefix(p)<$wikify name="ac" text=<<list-all-codes>> ><$list filter="""[enlist<ac>regexp[^$p$\d\d\d,*]]""" variable="pc"><<pc>></$list></$wikify>\end
\define build-code-table(p)
<table><tr><th>Cxyz</th><th>Name of tiddler</th><th>Content of `veld`</th></tr>
<$wikify name="pc" text=<<get-codes-by-prefix $p$>> ><$list filter="""[enlist<pc>]""" variable="c"><$list filter="""[search:veld<c>]""" variable="t"><tr><td><<c>></td><td><<t>></td><td>{{{[<t>get[veld]]}}}</td></tr></$list></$list></$wikify> </table>\end
Cxyz | Name of tiddler | Content of veld |
---|---|---|
C801 | tiddler4 | C801 |
C803 | tiddler5 | D 20, 1946- KL1, 1947- KV1, 1950- C803, A879 |
C804 | tiddler1 | C804, A878 |
Cxyz | Name of tiddler | Content of veld |
---|
D806 |
http://www.tongerner.nl/ tab 'Techniek', click the link 'Techniek'.
In the 'Techniek' wiki choose 'Marineschepen' from the 'Techniek' menu.
Tab 'Databank' > 'Pennantnummers' shows listings of different kinds of ships filtered by pennant nummber. The only exception is Ondersteuningsvaartuigen (A for Auxilliary) which is done manually (containing elements that could not be filtered).