[Filters] Get "Field value" that contain spaces

64 views
Skip to first unread message

Mohamed Amin

unread,
Oct 1, 2020, 10:09:14 AM10/1/20
to TiddlyWiki
Hello All,


Suppose that I've a Tiddler called "myTiddler" with 2 fields :
  1.  address1 = 14 My St.
  2.  address2 = MyTown

I need to get those values using filters, so I tried :

<$set name="msa" filter="[[My Tiddler]get[address1]]" >
        <$text text=<
<msa>>/>
</$set>

The Output is = [[14 My St.]]

<$set name="msa" filter="[[My Tiddler]get[address2]]" >
        <$text text=<
<msa>>/>
</$set>

The Output is = MyTown

So, Why the "[[]]" is showing up in the first case? and How can I get the filed value without it?

Thanks in advance

Saq Imtiaz

unread,
Oct 1, 2020, 10:16:12 AM10/1/20
to TiddlyWiki
<$set name="msa" filter="[[My Tiddler]get[address1]]" select="0">
        <$text text=<
<msa>>/>
</$set>

Mohamed Amin

unread,
Oct 1, 2020, 10:32:19 AM10/1/20
to TiddlyWiki
Thanks a lot Saq for your quick answer,

I've spent the last 2 hours trying and telling to myself : don't be silly, it seems very simple.
What I'm saying now is : may be I could figure it out in 2 days. :)

Thanks again

TW Tones

unread,
Oct 1, 2020, 7:27:15 PM10/1/20
to TiddlyWiki
Mohammad, FYI

The filter used to set msa is by default responsible for returning titles, tiddler titles, 

Unless it was delimited as we see in the result with the square brackets, we would not know where the title began and ended, and your result would not be a tiddler link in the result on screen.

The Text widget is letting us see this value exactly as it is. 

Rather than using set you could use wikify. 

An important lesson here is that the value is not always what it seems, so sometimes you need to take an additional step to ensure it is appropriate for a subsequent test like a filter.

\define varname() $(var)$/{{!!feildname}}
<$wikify name=varname2 text="""<<varname>""">
... [all[current[addprefix<varname2>] ...
</$wikify>
Thus we wikify the value at the last moment to ensure it works inside our filter.

Saq,
Interesting work around there using the select, this has some potential for different use cases. Thanks for showing this.

Regards
Tones

Mohamed Amin

unread,
Oct 1, 2020, 11:13:18 PM10/1/20
to TiddlyWiki
Thanks TW Tones for your help, appreciate it

Regards
Reply all
Reply to author
Forward
0 new messages