Dynamic Tiddler Call

98 views
Skip to first unread message

Lisa Wasserman

unread,
Apr 27, 2020, 10:33:02 PM4/27/20
to TiddlyWiki
I'm rather stuck.

I want to transclude the contents of a tiddler that I dynamically choose.  Specifically, I want to display the journal entry tiddler titled with today's date, a space, and the same project as the parent tiddler.  I tried using the following code:

\define journalTiddlerName( )
22-April-2020 $(project)$
\end
<$set name="project" value={{!!project}}>
<<journalTiddlerName>>
<p><h2><$view tiddler=<<journalTiddlerName>> field="created" format="date" template="DD-MMM-YYYY"/></h2></p>
<p><$transclude tiddler=<<journalTiddlerName>> mode="block" /></p>
</$set>

I have a project field on the parent tiddler that reads WR-38972, so I expect to see:

22-April-2020 WR-38972
22-April-2020 WR-38972
Contents of my transcluded tiddler.


It  exists, and has a plain text string in the body.  Unfortunately, all I get is the first line, "22-April-2020 WR-38972".  The macros aren't accepting the string as a tiddler name, but I don't know why.  Any thoughts, please?

Lisa Wasserman

unread,
Apr 27, 2020, 10:48:41 PM4/27/20
to TiddlyWiki
I tried changing all of my variables to be enclosed by double underscores.  

\define journalTiddlerName( )
22-April-2020 $(project)$
\end
<$set name="project" value={{!!project}}>
<$wikify name="todaysEntry" text=<<__journalTiddlerName__>>>
<p><h2><$view tiddler=<<__todaysEntry__>> field="created" format="date" template="DD-MMM-YYYY"/></h2></p>
<p><$transclude tiddler=<<__todaysEntry__>> mode="block" /></p>
</$wikify>
</$set>

Now the text appears, but the line where I'm transcluding the tiddler body throws a recursion error.  I'm not purposefully transcluding a tiddler into itself, and I'm explicitly calling the 22-April-2020 WR-38972 tiddler.  I still don't understand how this is working.

Mark S.

unread,
Apr 27, 2020, 11:06:33 PM4/27/20
to TiddlyWiki
This is what I see when I run it:

22-April-2020 WR-38972

27-April-2020


These are my contents



Which is what I expect (on line 2 you're asking for a formatted date).

Without being able to see your actual tiddlers it's hard to know for sure what's happening. If I were to speculate, perhaps you have a slight misspelling with "22-April-2020 WR-38972" or a an extra space on the end.

TonyM

unread,
Apr 27, 2020, 11:08:23 PM4/27/20
to tiddl...@googlegroups.com
Lisa,

[Edited]

I assume 22-April-2020 WR-38972 actually exists?

One support and debugging method is to make a minimal example that works on tiddlywiki.com other can drop on it and look closer.

Regards
Tony

Lisa Wasserman

unread,
Apr 28, 2020, 10:53:14 AM4/28/20
to TiddlyWiki
If I misspelled the tiddler, I wouldn't get the middle line, would I?

Lisa Wasserman

unread,
Apr 28, 2020, 11:04:29 AM4/28/20
to TiddlyWiki
We're allowed to modify tiddlywiki.com?

--Lisa

On Monday, April 27, 2020 at 10:08:23 PM UTC-5, TonyM wrote:

Lisa Wasserman

unread,
Apr 28, 2020, 11:12:07 AM4/28/20
to TiddlyWiki
I made two tiddlers on tiddlywiki.com: 22-April-2020 WR-38972 and WR-38972 Container.  The former has a line of text in it.  The latter has my latest attempt at the above code, plus the project field, set to WR-38972.  It's still showing recursion errors.  

Mark S.

unread,
Apr 28, 2020, 12:32:46 PM4/28/20
to TiddlyWiki
What Tony was saying was that once you've demonstrated to yourself the problem on TiddlyWiki.com, you can export the tiddlers as JSON and post to this forum.

One way to export those tiddlers is to go to the advanced search tiddler (click on magnifying lens). Select the "Filter" tab. To the right of the search box is a down (V) icon. Click on it and select "recently modified tiddlers". Click on the export button (icon with upper arrow in trash bucket).  Save the downloads as JSON. Post the file to the forum.

HTH

Lisa Wasserman

unread,
Apr 28, 2020, 1:05:52 PM4/28/20
to tiddl...@googlegroups.com
Attached are my two tiddlers.  The container transcludes the entry.

--Lisa

container.json
entry.json

Mat

unread,
Apr 28, 2020, 1:21:07 PM4/28/20
to TiddlyWiki
Lisa Wasserman wrote:
We're allowed to modify tiddlywiki.com?

You can do whatever you want there - but you can't save it to the server. So what you're manipulating is really the local copy of the page. (You can save it locally.)

If you intend to do more sharing of tiddlers you might want to install the Share plugin.

<:-)

Mark S.

unread,
Apr 28, 2020, 2:00:36 PM4/28/20
to TiddlyWiki

The <<__variable__>> format is only for use inside of macros. Once I removed the underscores (__), then I got the expected output:

Here's my screen shot:

Reply all
Reply to author
Forward
0 new messages