Discussion:
[tw] Transcluding a field value, one more time
Add Reply
Steven Schneider
2017-07-25 00:53:03 UTC
Reply
Permalink
Raw Message
Hi,

Can't quite get this right....

In http://sunypoly-schedule-explorer.tiddlyspot.com/ the current default
tiddler is a macro that generates a link to tiddlers based on values of a
field in a set of tiddlers. So, in this case, a schedule, <$macrocall
$name="show-field" this-field="room"/> -- all possible values for room are
collected and put in a button; clicking on the button creates a tiddler
that is supposed to be room-{{!!room}}. It's close -- I'm getting exactly
that: *room-{{!!room}}*. I'd like to transclude the value of room into the
tiddler title, of course.

Any help, much appreciated. Thanks!

(I find transcluding field values rather difficult, and I seem to do a lot
of it these days...)

//steve.



\define getFieldValue() {{!!$(this-field)$}}


\define makeTiddlerName() $(this-field)$-$(this-value)$


\define show-field($this-field$)


<$list
filter="[tag[schedule-elements]each[$this-field$]sort[$this-field$]]">
currentTiddler: <$link><<currentTiddler>></$link><br>
<$vars this-field=$this-field$ >
<$set name=this-value value=<<getFieldValue>>>
1 this-field: <<this-field>><br>
2 this-value: <<this-value>><br>
3 makeTiddlerName: <<makeTiddlerName>><br>
<$button>
<<makeTiddlerName>>
<$action-setfield $tiddler=<<makeTiddlerName>> field-name=<<this-field>>
field-value=<<getFieldValue>> role="field-value"
orig-tag="schedule-elements"/>
<$action-navigate $to=<<makeTiddlerName>>/>
</$button><br>
\end

<$macrocall $name="show-field" this-field="room"/>
--
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 ***@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/761ff08f-9eca-4758-a0d3-e9820bb2d64d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mat
2017-07-25 02:07:28 UTC
Reply
Permalink
Raw Message
Hi Steve!
That doesn't look correct to me;

\define show-field($this-field$)

what's this?

<$list
filter="[tag[schedule-elements]each[$this-field$]sort[$this-field$]]">


Should probably not be empty rows there and the macro parameter should
probably not be with dollars.


<:-)
--
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 ***@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/04a09d26-fe72-4a90-9cbf-ba4f037f240a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Steven Schneider
2017-07-25 17:12:50 UTC
Reply
Permalink
Raw Message
Hey, thanks. I (1) resaved my tiddlyspot, so this code is in the default
tiddler and (2) made the changes mat suggested. But I am still not able to
transclude the value of a field into the name of a tiddler.

in these lines


<<makeTiddlerName>>
<$action-setfield $tiddler=<<makeTiddlerName>> field-name=<<this-field>>
field-value=<<this-value>> role="field-value" orig-tag="schedule-elements"/>
<$action-navigate $to=<<makeTiddlerName>>/>

<<makeTiddlerName>> , which is \define makeTiddlerName()
$(this-field)$-$(this-value)$, works on its own as <<makeTiddlerName>> but
doesn't work as a transcluded link in $action-setfield or $action-navigate


Here's all the revised code

\define getFieldValue() {{!!$(this-field)$}}

\define makeTiddlerName() $(this-field)$-$(this-value)$

\define show-field(this-field)
this-field=$this-field$<br><hr>
<$vars this-field=$this-field$ >
<$list filter="[tag[schedule-elements]each<this-field>sort<this-field>]">
0 currentTiddler: <$link><<currentTiddler>></$link><br>
<$set name=this-value value=<<getFieldValue>>>
1 this-field: <<this-field>><br>
2 this-value: <<this-value>><br>
3 makeTiddlerName: <<makeTiddlerName>><br>
4 <$button>
<<makeTiddlerName>>
<$action-setfield $tiddler=<<makeTiddlerName>> field-name=<<this-field>>
field-value=<<this-value>> role="field-value" orig-tag="schedule-elements"/>
<$action-navigate $to=<<makeTiddlerName>>/>
</$button><hr>
\end

<$macrocall $name="show-field" this-field="credits"/>
Post by Mat
Hi Steve!
That doesn't look correct to me;
\define show-field($this-field$)
what's this?
<$list
filter="[tag[schedule-elements]each[$this-field$]sort[$this-field$]]">
Should probably not be empty rows there and the macro parameter should
probably not be with dollars.
<:-)
--
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 ***@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/0e17788b-e5e5-40dc-80f5-b08c5e25df2d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Mark S.' via TiddlyWiki
2017-07-25 17:56:48 UTC
Reply
Permalink
Raw Message
Try this

\define show-field(this-field)
this-field=$this-field$<br><hr>
<$vars this-field=$this-field$ >
<$list filter="[tag[schedule-elements]each<this-field>sort<this-field>]">
0 currentTiddler: <$link><<currentTiddler>></$link><br>
<$set name=this-value value=<<getFieldValue>>>
<$wikify name=newtid text="<<makeTiddlerName>>">
1 this-field: <<this-field>><br>
2 this-value: <<this-value>><br>
3 makeTiddlerName: <<newtid>><br>
4 <$button>
<<newtid>>
<$action-setfield $tiddler=<<newtid>> field-name=<<this-field>> field-value
=<<this-value>> role="field-value" orig-tag="schedule-elements"/>
<$action-navigate $to=<<newtid>>/>
</$button></$wikify></$set><hr>
\end


Used wikify widget to force the macro to be interpreted before use. Also
added in missing end tag </$set>

Good luck,
Mark
Post by Steven Schneider
Hi,
Can't quite get this right....
In http://sunypoly-schedule-explorer.tiddlyspot.com/ the current default
tiddler is a macro that generates a link to tiddlers based on values of a
field in a set of tiddlers. So, in this case, a schedule, <$macrocall
$name="show-field" this-field="room"/> -- all possible values for room
are collected and put in a button; clicking on the button creates a tiddler
that is supposed to be room-{{!!room}}. It's close -- I'm getting exactly
that: *room-{{!!room}}*. I'd like to transclude the value of room into
the tiddler title, of course.
Any help, much appreciated. Thanks!
(I find transcluding field values rather difficult, and I seem to do a lot
of it these days...)
//steve.
\define getFieldValue() {{!!$(this-field)$}}
\define makeTiddlerName() $(this-field)$-$(this-value)$
\define show-field($this-field$)
<$list
filter="[tag[schedule-elements]each[$this-field$]sort[$this-field$]]">
currentTiddler: <$link><<currentTiddler>></$link><br>
<$vars this-field=$this-field$ >
<$set name=this-value value=<<getFieldValue>>>
1 this-field: <<this-field>><br>
2 this-value: <<this-value>><br>
3 makeTiddlerName: <<makeTiddlerName>><br>
<$button>
<<makeTiddlerName>>
<$action-setfield $tiddler=<<makeTiddlerName>> field-name=<<this-field>>
field-value=<<getFieldValue>> role="field-value"
orig-tag="schedule-elements"/>
<$action-navigate $to=<<makeTiddlerName>>/>
</$button><br>
\end
<$macrocall $name="show-field" this-field="room"/>
--
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 ***@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/5d0d4de6-93e0-4293-b111-bb75c5cb89d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Steven Schneider
2017-07-25 23:46:58 UTC
Reply
Permalink
Raw Message
Mark, thanks. That works.

<$wikify> was an answer to a question I had a few months ago, too -- Thomas
I think used it in one of his macros. I still don't quite get what it does,
but it seems to do the trick sometimes.


//steve.
Post by 'Mark S.' via TiddlyWiki
Try this
\define show-field(this-field)
this-field=$this-field$<br><hr>
<$vars this-field=$this-field$ >
<$list filter="[tag[schedule-elements]each<this-field>sort<this-field>]">
0 currentTiddler: <$link><<currentTiddler>></$link><br>
<$set name=this-value value=<<getFieldValue>>>
<$wikify name=newtid text="<<makeTiddlerName>>">
1 this-field: <<this-field>><br>
2 this-value: <<this-value>><br>
3 makeTiddlerName: <<newtid>><br>
4 <$button>
<<newtid>>
<$action-setfield $tiddler=<<newtid>> field-name=<<this-field>> field-
value=<<this-value>> role="field-value" orig-tag="schedule-elements"/>
<$action-navigate $to=<<newtid>>/>
</$button></$wikify></$set><hr>
\end
Used wikify widget to force the macro to be interpreted before use. Also
added in missing end tag </$set>
Good luck,
Mark
Post by Steven Schneider
Hi,
Can't quite get this right....
In http://sunypoly-schedule-explorer.tiddlyspot.com/ the current default
tiddler is a macro that generates a link to tiddlers based on values of a
field in a set of tiddlers. So, in this case, a schedule, <$macrocall
$name="show-field" this-field="room"/> -- all possible values for room
are collected and put in a button; clicking on the button creates a tiddler
that is supposed to be room-{{!!room}}. It's close -- I'm getting exactly
that: *room-{{!!room}}*. I'd like to transclude the value of room into
the tiddler title, of course.
Any help, much appreciated. Thanks!
(I find transcluding field values rather difficult, and I seem to do a
lot of it these days...)
//steve.
\define getFieldValue() {{!!$(this-field)$}}
\define makeTiddlerName() $(this-field)$-$(this-value)$
\define show-field($this-field$)
<$list
filter="[tag[schedule-elements]each[$this-field$]sort[$this-field$]]">
currentTiddler: <$link><<currentTiddler>></$link><br>
<$vars this-field=$this-field$ >
<$set name=this-value value=<<getFieldValue>>>
1 this-field: <<this-field>><br>
2 this-value: <<this-value>><br>
3 makeTiddlerName: <<makeTiddlerName>><br>
<$button>
<<makeTiddlerName>>
<$action-setfield $tiddler=<<makeTiddlerName>> field-name=<<this-field>>
field-value=<<getFieldValue>> role="field-value"
orig-tag="schedule-elements"/>
<$action-navigate $to=<<makeTiddlerName>>/>
</$button><br>
\end
<$macrocall $name="show-field" this-field="room"/>
--
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 ***@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/5f5d2432-959d-47d8-8fab-ff72f23767c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...