Getting a field value from a transcluded field name

87 views
Skip to first unread message

Steven Schneider

unread,
Jan 24, 2018, 12:27:34 PM1/24/18
to TiddlyWiki
Hi folks,

I've written a macro that identifies and presents tiddlers as slides in a slideshow with this: 

<<punchshow2 "welcome-to-class">>

My macro sets variable slidetag as follows:
<$set name=slidetag value="""$slidetag$""">


Tiddlers to be included in the slideshow are tagged with the name of the show (example: "welcome-to-class") and have a field of the same name (example: welcome-to-class) with value = 1 (or 2, etc.)

I want to dynamically set the bgcolor of the tiddlers based on slidenumber.

How do I reference a field that is defined through transclusion? In the code below, I'm trying to get the value of the field <<slidetag>> into a variable <<slidenumber>>

<$list filter="[tag<slidetag>!nsort<slidetag>]" >
<$set name="slidenumber" filter="[all[current]field<slidetag>]">
...
doesn't work.

Suggestions?

Thanks, //steve.


Jeremy Ruston

unread,
Jan 24, 2018, 12:45:20 PM1/24/18
to tiddl...@googlegroups.com
Hi Steve

How do I reference a field that is defined through transclusion? In the code below, I'm trying to get the value of the field <<slidetag>> into a variable <<slidenumber>>

<$list filter="[tag<slidetag>!nsort<slidetag>]" >
<$set name="slidenumber" filter="[all[current]field<slidetag>]">
...
doesn't work.

Try

<$list filter="[tag<slidetag>!nsort<slidetag>]">
<$set name="slidenumber" tiddler=<<currentTiddler>> field="slidetag">
...

The trick is a new feature of the set widget (since 5.1.14) that allows a variable to be set directly from a tiddler field (or index).

Best wishes

Jeremy.



Suggestions?

Thanks, //steve.



--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/8a4cf45f-12eb-4a8a-82d6-d4ea375cd729%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Schneider

unread,
Jan 26, 2018, 12:45:03 PM1/26/18
to TiddlyWiki
Thanks, Jeremy.

But, did you mean:

<$list filter="[tag<slidetag>!nsort<slidetag>]">
<$set name="slidenumber" tiddler=<<currentTiddler>> field=<<slidetag>>>

(It is almost working; i've got something else wrong now :)

//steve.

Mark S.

unread,
Jan 26, 2018, 1:22:57 PM1/26/18
to TiddlyWiki
This example worked for me, but I think it may need to have the inner <$set> changed to another <$list>.

<$set name=slidetag value="myslide">
<$list filter="[tag
<slidetag>!nsort<slidetag>]" >
<$set name="slidenumber" filter="[all[current]get
<slidetag>]">
<
<slidenumber>><br/>
</$set>
</$list>
</$set>


The main thing is, that you needed the "get" operator, not the field operator. The field operator filters by a field's contents. The "get" operator returns the value of a field.

Good luck!
-- Mark
Reply all
Reply to author
Forward
0 new messages