[TW5] Filter by field value

84 views
Skip to first unread message

Tristan Kohl

unread,
Apr 6, 2017, 10:30:25 AM4/6/17
to TiddlyWiki
Hey guys,

sorry to stress your patience again but I really suck at some of the TW things :/

Since I fixed my last problem by going another way I am now stuck with filters...

Tiddler 1:

hive-id: 2
tags: inspection
title: Inspection 1

Tiddler 2:

hive-id: 2
tags: hive
title: Hive 2 

Which uses this template:

title: $:/plugins/beehive/templates/hive
tags: $:/tags/ViewTemplate

<$list filter="[is[current]tag[hive]]">

<<tabs "$:/plugins/beehive/views/listinspections $:/plugins/beehive/masks/newinspection" "$:/plugins/iceity/views/listinspections">>

Tiddler 3:

title: $:/plugins/beehive/views/listinspections
caption: List inspections

<<table [tag[inspection]hive-id{!!hive-id}] "title caption inspection-date inspection-type inspection-description" "UID Name Date Type Description">>

{!!hive-id}

My problem:
If I search by hand for: [tag[inspection]hive-id[2]] I get Tiddler 1 which is fine. But Tiddler 3 does not display Tiddler 1 even though the TextReference in the end returns a "2" which should end up in the filter as well.

My only clue is that the template for Tiddler 2 messes things up for the filter by changing the <<currentTiddler>> when tabbing stuff.

I hope there is still someone willing to help me out, my head is already spinning.

Thank you very much,
Tristan

Mark S.

unread,
Apr 6, 2017, 2:17:38 PM4/6/17
to TiddlyWiki
What's in the <<table>> macro? Does anything show up when you run tiddler 3? It might help if you posted your entire TW file.

I'm thinking that the filter gets evaluated too late. So you might have to send it up a level like:

\define table2(id)
<<table [tag[inspection]hive-id[$id$]] "title caption inspection-date inspection-type inspection-description" "UID Name Date Type Description">>
\end

<$macrocall $name=table2 id={{!!hive-id}}/>

Good luck,
Mark

Tristan Kohl

unread,
Apr 6, 2017, 2:51:45 PM4/6/17
to TiddlyWiki
Hi Mark,

I dropped some "console.log" (I write only JS macros since I am comfortable with JS) and found out, that my table macro was indeed called with: "[tag[inspection]hive-id{!!hive-id}]" so your guess was right. I tried your approach and it works, you are my hero I would never have come up with that :D

However that shows to me once more that I still do not get how macro and widget evaluation works. Boy, I do not even get the difference between widget and macro as some macros have the same names and do the same thing - at least that is what it feels like. Do you have some source that explains this in some more detail as the documentation is not enough for me obviously?

Thanks again I have a strong feeling you saved my little project once more.
Tristan
Reply all
Reply to author
Forward
0 new messages