This sort of thing used to drive me nuts. Still does sometimes. It looks 
for all the world
like you have properly formed and even tested your string regular 
expression construction.
But you haven't because your macro is first getting passed to the *value 
*attribute, 
and THEN
being rendered. What you see on the screen is the rendered value, but not 
what value gets.

The solution is the WikifyWidget, that can render (wikify) the results of 
the macro the way
you mentally meant it to be. The results might look like what I've posted 
below.

Good luck!


\define rx_TidID_RelType(Tid RelType)
"$Tid$".*"$RelType$"
\end
-------------

''All Sub-tasks of this tiddler''

<$wikify name=rxSearch text="<<rx_TidID_RelType {{!!tmap.id}} SubTaskOf>>" >

rxSearchTerms: <<rxSearch>>

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

</$list>

</$wikify>



On Saturday, July 20, 2019 at 3:34:32 PM UTC-7, MagoArcade wrote:
>
> Hi - having problems with variables in filters. The code below doesn't 
> produce any results:
>
> \define rx_TidID_RelType(Tid RelType)
> "$Tid$".*"$RelType$"
> \end
> -------------
>
> ''All Sub-tasks of this tiddler''
>
> <$set name=rxSearch value=<<rx_TidID_RelType {{!!tmap.id}} SubTaskOf>>>
>
> rxSearchTerms: <<rxSearch>>
>
> <$list filter="[regexp:tmap.edges<rxSearch>]">
>
> </$list>
>
> However, it's producing the regex search correctly on examining the output:
>
> ------------------------------
>
> *All Sub-tasks of this tiddler*
>
> .*rxSearchTerms: "087aa75e-ec77-4cd2-a774-c41c0ee52382".*"SubTaskOf"
>
>
>
> tmap.edges essentially holds an array, thus having to use regex. Here's a 
> couple of examples of data from tmap.edges:
>
>
> "a2373aa7-f71b-48e3-ac64-10e464c135a8":{"to":"087aa75e-ec77-4cd2-a774-c41c0ee52382","type":"SubTaskOf"
>
> "a2373aa7-f71b-48e3-ac64-10e464c135a8":{"to":"087aa75e-ec77-4cd2-a774-c41c0ee52383","type":"SubTaskOf"
>
> The RegEx search is resolved to something like this format:
>
> .*"087aa75e-ec77-4cd2-a774-c41c0ee52382".*"SubTaskOf"
>
> I know this works: regexr.com/4hqih
>
> I also have it working filtering results at other points in my code:
>
> <$list filter="[regexp:tmap.edges{!!tmap.id}]">
>
>
> </$list>
>
> this produces a list of all entries matching the current tiddler's tmap.id
>
> Why isn't variable substitution working in this instance?
>
> I chose to use a macro due to the complexities introduced into doing it 
> inline with special characters (quotes in this instance) 
>
> Any help[ much appreciated (I know I'm hitting these forums hard tonight, 
> but just learning TiddlyWiki!)
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/358b5f03-0a6f-4221-8d14-204ef29563f3%40googlegroups.com.

Reply via email to