fields operator and macro parameter

68 views
Skip to first unread message

Mohammad

unread,
Jul 9, 2019, 11:57:39 PM7/9/19
to tiddl...@googlegroups.com
Why fields operator in the below code does not work


\define mac1(tid)
<$list filter="[<__tid__>fields[]]" variable="fld">
<$text text=<<fld>> />
</$list>

\end

<<mac1 tid:"tesTid">>


Where tesTid is


created: 20190710030221986
field1: Hi
field2: 123
modified: 20190710030313066
revision: 0
tags: [[tag 22]] tag1
title: testTid
type: text/vnd.tiddlywiki

This is a test

--Mohammad

Mark S.

unread,
Jul 10, 2019, 12:07:48 AM7/10/19
to TiddlyWiki
You're going to laugh ...

<<mac1 tid:"testTid">>

Mohammad

unread,
Jul 10, 2019, 3:14:02 AM7/10/19
to TiddlyWiki
Thats quite TRUE!
I was one hour confusing what happened to TW :-)

--Mohammad

PMario

unread,
Jul 10, 2019, 4:33:51 AM7/10/19
to TiddlyWiki
On Wednesday, July 10, 2019 at 9:14:02 AM UTC+2, Mohammad wrote:
Thats quite TRUE!
I was one hour confusing what happened to TW :-)

Yea, Sometimes shi? happens ;)
-m

Watt

unread,
Jul 10, 2019, 11:18:02 AM7/10/19
to TiddlyWiki
Hi Mohammad
Could this be extended to show the field values as well?

Mohammad

unread,
Jul 10, 2019, 2:25:47 PM7/10/19
to TiddlyWiki
Hi Watt,
 I would like to refer you to TW-Scripts and Data Tiddler trail at

 file:///G:/TW/TW-Scripts/Scripts%20in%20TW%205.1.20-pre.html#datatiddler

The simple answer is yes! In simple NOT rendered form it is as below

\define mac1(tid)
<$list filter="[<__tid__>fields[]]" variable="fld">
<$text text=<<fld>> />
<$text text={{{ [<__tid__>getindex<fld>] }}} />
</$list>

\end

<<mac1 tid:"tesTid">>

Watt

unread,
Jul 10, 2019, 3:09:12 PM7/10/19
to TiddlyWiki
Thanks again Mohammad, I tweaked it a bit to get the values to show;

<$text text={{{ [<__tid__>get<fld>] }}} />

I replaced getindex with just get. (For the benefit of future readers.)

Great stuff Mohammad.

Reply all
Reply to author
Forward
0 new messages