Unexpected variable behaviour in filter

31 views
Skip to first unread message

MagoArcade

unread,
Jul 20, 2019, 5:13:49 PM7/20/19
to TiddlyWiki
Reading this would imply you can include variables in filters, but enclosing the variable name in "<>" However, my code is behaviour differently. 

This:

''For this Catagory:''


<$set name=catID value=087aa75e-ec77-4cd2-a774-c41c0ee52382>


Var catID: <<catID>>


<$list filter="[regexp:tmap.edges[087aa75e-ec77-4cd2-a774-c41c0ee52382]]">


</$list>

-------------

Produces this:

For this Catagory:

Var catID: 087aa75e-ec77-4cd2-a774-c41c0ee52382



(ie. results). Whilst this:

Whilst this:


''For this Catagory:''


<$set name=catID value=087aa75e-ec77-4cd2-a774-c41c0ee52382>


Var catID: <<catID>>


<$list filter="[regexp:tmap.edges[<catID>]]">


</$list>

-------------

Produces this:

For this Catagory:

Var catID: 087aa75e-ec77-4cd2-a774-c41c0ee52382




(i,e. no results). 

How can this be so?

Mark S.

unread,
Jul 20, 2019, 5:25:55 PM7/20/19
to TiddlyWiki
When using the angle brackets (< and >) in a filter for variable substitution, the brackets swap places with the original square ([ and ]) brackets. So
your second filter should be like:

filter="[regexp:tmap.edges<catID>]">

Good luck!

MagoArcade

unread,
Jul 20, 2019, 5:27:52 PM7/20/19
to TiddlyWiki
Bingo! Thanks fella. Blimey - it reminds me of learning batch, this!
Reply all
Reply to author
Forward
0 new messages