How to create custom filter?

94 views
Skip to first unread message

Jesse Racine

unread,
Nov 9, 2019, 8:57:52 AM11/9/19
to TiddlyWikiDev
I'm interested in learning how to create custom filter operators. I see that the filter operators are located in $:/core/modules/filters .

If I created my own filter operator, would I have to put it there, or is there a way to introduce a new filter operator without having to put it in the core location?

@TiddlyTweeter

unread,
Nov 9, 2019, 9:51:54 AM11/9/19
to TiddlyWikiDev
You can put it anywhere.

PMario

unread,
Nov 9, 2019, 10:00:47 AM11/9/19
to TiddlyWikiDev
Hi,
Your own filter operators can be plugins. you only need to set the module type right.
I did create new filter stuff with my uni-link plugin. see: https://github.com/wikilabs/plugins/tree/master/wikilabs/uni-link/tiddlers/modules/filters
as an example.
-m

PMario

unread,
Nov 9, 2019, 10:02:17 AM11/9/19
to TiddlyWikiDev
On Saturday, November 9, 2019 at 2:57:52 PM UTC+1, Jesse Racine wrote:
I'm interested in learning how to create custom filter operators. I see that the filter operators are located in $:/core/modules/filters

Which operator do you need?

-m

Jesse Racine

unread,
Nov 9, 2019, 11:45:41 AM11/9/19
to TiddlyWikiDev
Thanks very much for your help. Your last post helped a lot. I am coming up with ideas to make my own task tracking plugin. There will be a "duedate" field in each task tiddler, but some due dates will have a repeat setting (like monthly, weekly, etc). I want a way to either modify the due dates of the task tiddlers appropriately, or create a custom filter.

Let's say that you set a task due on November 9th, 2019, and set it to weekly. That task tiddler should then be due every Saturday, for example. I want to either figure out a way to dynamically modify the due date field so that every week the due date field will automatically change the due date field (in this case set it 7 days ahead), or create a custom filter that will just do that math and filter out tiddlers that are due that day.

So for my filter idea, there would be a "current tasks" tiddler. The current tasks tiddler would have a list widget with a filter that would filter out all tasks due on the current day. For normal tasks (tasks without a repeat setting) that would be simple to accomplish with filters. But for the "repeat" tasks I am not sure how to filter those out appropriately. I am going to work on a custom filter that will examine the duedate field and the repeat field in task tiddlers, and then filter the ones out that are due today by doing basic date math on the duedate and with the repeat setting to filter out tiddlers that are due the current day (or month, week, etc).

PMario

unread,
Nov 10, 2019, 9:34:46 AM11/10/19
to TiddlyWikiDev
On Saturday, November 9, 2019 at 5:45:41 PM UTC+1, Jesse Racine wrote:
 ...
Let's say that you set a task due on November 9th, 2019, and set it to weekly. That task tiddler should then be due every Saturday, for example.

Every Saturday will be much easier then based on real dates. eg: TW already knows something like "startup actions".

So it would be easy to check if a TW is opened on eg: Wednesday and create an actions that writes a "list-actions-due-to-saturday" tiddler into the $:/DefaultTiddlers  tiddler.

The list-actions... tiddler could contain a list like

<<list-links "[all[tiddlers]due[Saturday]]">>

The action tiddler would look similar to:

\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]

<$set name=test value=<<now DDD>>>
<$reveal type="match" default=<<test>> text="Sunday">
<$action-setfield $tiddler="hugo" $value="it's Sunday"/>
</$reveal>
</$set>


BUT the above code creates a JS error with the latest TW version. ... see: Github issue.

So depending on what you really need, there may be existing solutions already.

more to come ... maybe ;)

-mario


PMario

unread,
Nov 10, 2019, 9:38:33 AM11/10/19
to TiddlyWikiDev
On Saturday, November 9, 2019 at 5:45:41 PM UTC+1, Jesse Racine wrote:

Let's say that you set a task due on November 9th, 2019, and set it to weekly. That task tiddler should then be due every Saturday, for example. I want to either figure out a way to dynamically modify the due date field so that every week the due date field will automatically change the due date field (in this case set it 7 days ahead), or create a custom filter that will just do that math and filter out tiddlers that are due that day.

I think, there should be a way to create NEW ToDo tiddlers based on your config-tiddlers.

So for me there should be configuration tiddler, that defines the "due to" behaviour. ... But there should be separated tiddlers that can be tagged: DONE. Those tiddlers need to be kept for some time, to have a possibility for "auditing" actions in the past

just some thoughts.
mario

PMario

unread,
Nov 10, 2019, 9:40:42 AM11/10/19
to TiddlyWikiDev
On Saturday, November 9, 2019 at 5:45:41 PM UTC+1, Jesse Racine wrote:
So for my filter idea, there would be a "current tasks" tiddler. The current tasks tiddler would have a list widget with a filter that would filter out all tasks due on the current day. For normal tasks (tasks without a repeat setting) that would be simple to accomplish with filters. But for the "repeat" tasks I am not sure how to filter those out appropriately. I am going to work on a custom filter that will examine the duedate field and the repeat field in task tiddlers, and then filter the ones out that are due today by doing basic date math on the duedate and with the repeat setting to filter out tiddlers that are due the current day (or month, week, etc).

hmmm,

I think, there is a misunderstanding, how TW and TW filtering works. ... but I'm not sure yet.

-m

TonyM

unread,
Nov 13, 2019, 11:57:55 PM11/13/19
to TiddlyWikiDev
Jesse,

I will remind you of my suggestion here

The trick is to make a date time stamp that you click when you action it. E.g. weekly-date and make a list that only lists items with a weekly date older than 7 days. This way you do not need to update the date field except when you touch it.

I am happy to explain this further but I seriously believe this to be a superior method. It is a little non-intuitive but I am confident it is a algorithm of substantial value. It will allow you to do everything you want much more simply. 

All that changes dynamically is today's date, which changes anyway. 

Further you can build into it a "synthetic date", for example you could set it 8 days from now and review items that will be due/overdue then, not now. You could use this if you were planning a holiday and list everything that would fall due when you are away. I use it to manage specific, daily, weekly, Fortnightly, Monthly, Quarterly half yearly and annual re-occuring items. It is more robust and less fragile.

 Regards
Tony

PMario

unread,
Nov 14, 2019, 11:23:11 AM11/14/19
to TiddlyWikiDev
Hi Jesse,

There is a different thread going on, which also wants to deal with "date, time, calendar ... riminders". There may be some overlap.

just some more infos.

-m

Jesse Racine

unread,
Nov 14, 2019, 6:54:25 PM11/14/19
to TiddlyWikiDev
Hello TonyM,

Thanks for your suggestion here. I apologize for not responding earlier, I haven't had time to revisit my TiddlyWiki ideas lately.
Reply all
Reply to author
Forward
0 new messages