How to filter tiddlers comparing title prefixes with system date?

43 views
Skip to first unread message

@magasine

unread,
Feb 28, 2018, 6:07:55 AM2/28/18
to tiddl...@googlegroups.com
Hi,

I have a question!

My TW has titled tiddlers with a prefix that references dates, as in the examples below:

20180115 - Content of the Past
20180228 - Present Content
20180315 - Content of the Future

I have a macro (StartupActions: http://ooktech.com/jed/ExampleWikis/StartupActions/) that is turned on for page load, directing the fill of fields of certain tiddlers, with an appropriate status: past, present or future.

Question:

How can I build a filter that can display each of these conditions, past, present, and future, based only on the prefix analysis contained in the titles, compared to the system date I get from the macro << now YYY0MM0DD >>

My code:

\define tempNodeColor()
<$set name="hoje" value=<<now YYYY0MM0DD>> >
<$set name="tagMesM" value=<<now YYYY-0MM>> >

 <!-- ADICIONA COR GREEN AO NODE DO MM E TAG ANO-MES DO MES CORRENTE, CASO NÃO EXISTA -->

<$list filter="[all[]prefix<hoje>]">
<$action-setfield $field="_tgr_node_class_add" $value="my-green-node" />
<$action-listops $field=tags $subfilter='+[append<tagMesM>]'/>
</$list>

<!-- ADICIONA CORES AO NODE DO MM PARA CONTEÚDOS TAGEADOS COM EVENTOS-REALIZADOS E EVENTOS-REALIZANDO -->

<$list filter="[tag[Past]]">
<$action-setfield $field="_tgr_node_class_add" $value="my-gray-node" />
</$list>

<$list filter="[tag[Present]]">
<$action-setfield $field="_tgr_node_class_add" $value="my-green-node" />
</$list>

</$set>
</$set>
\end

<<tempNodeColor>>



Message has been deleted

Mark S.

unread,
Feb 28, 2018, 10:33:55 AM2/28/18
to TiddlyWiki
It would be better to put your date (in TW date format) in it's own field. Then use the day and sameday filter operators to determine future/past/present.

-- Mark
Reply all
Reply to author
Forward
0 new messages