Transclude a value of a X-tiddler-dictionary by using a variable

88 views
Skip to first unread message

arnaud MESLE

unread,
Dec 28, 2018, 9:20:19 AM12/28/18
to TiddlyWiki
Hello,

I'm a newbie with TW and i'm trying to find a way to transclude a value of a X-tiddler-dictionary by using a variable, but nothing works so i would like to know if it is possible from your opinion ?

For the test, i have a datatiddler "ressource" with this entry :
{
   "step1_summary": "blabla1",
}


My target is to can set "step1" in a variable and to try to find a syntax for transclude the value of the "step1_summary" item.
On an other tiddler i have done three tests but nothing displays this value...

test 1:
<$set name="var0" value="step1">
{{ressrouce##<<var0>>_summary}}

test 2:
<$set name="var1" value="{{ressource##step1_summary}}">
<<var1>>

test 3:
<$set name="var2" value="step1_summary">
{{ressource##<<var2>>}}

Any help would be appreciate !

Cheers - Arnaud

Eric Shulman

unread,
Dec 28, 2018, 10:59:38 AM12/28/18
to TiddlyWiki
On Friday, December 28, 2018 at 6:20:19 AM UTC-8, arnaud MESLE wrote:
I'm a newbie with TW and i'm trying to find a way to transclude a value of a X-tiddler-dictionary by using a variable, but nothing works so i would like to know if it is possible from your opinion ?

My target is to set "step1" in a variable and to try to find a syntax for transclude the value of the "step1_summary" item.

test 2:
<$set name="var1" value="{{ressource##step1_summary}}">
<<var1>>

Greeting Arnaud... welcome to TiddlyWiki!...

In TW5, quotes don't just surround the parameter values; they indicate the kind of parameter and how it is to be handled.

* a literal text parameter value is enclosed in double quotes:
value="foobar"

* a reference to a tiddler field or data dictionary index is enclosed in doubled curly braces
value={{tiddlername!!fieldname}}
value
={{tiddlername##indexname}}
(note: if the 'tiddlername' portion of the reference is omitted, the reference is to a field/index in the currentTiddler)

* a reference to a variable is enclosed in doubled angle brackets
value=<<variablename>>

Thus, your "test 2" was very close... just remove the double-quotes around the value parameter, like this:
<$set name="var1" value={{ressource##step1_summary}}>
   
<<var1>
>
</$set>

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals

Mohammad

unread,
Jan 31, 2019, 1:24:12 PM1/31/19
to TiddlyWiki
Added to TW-Scripts.
Reply all
Reply to author
Forward
0 new messages