Your macro should look like this:

\define mymacro()
<$set name="result" value="Hi Bob">
<<result>>
</$set>
\end

<<mymacro>>

You had a forward slash at the end of the <$set.../> tag. The value of the 
variable only "lives" between a set of tags, e.g. <$set ...></$set>. Since 
you didn't have a set of tags, the value ended before it was invoked.

You invoked "result" as <result>. Variables set by the setwidget get 
invoked with <<result>>. These are different than variables passed to the 
macro which get invoked like $result$.

It gets more confusing. If you had called <$set> before invoking the macro, 
then inside the macro definition you could use $(result)$, like this:

\define mymacro()
<$set name="result" value="Hi Bob">
<<result>>
$(result)$
</$set>
\end

<$set name="result" value="Hi Doug">
<<mymacro>>
</$set>


Which results in:

Hi Bob Hi Doug


HTHSH (Hope this helped somehow)

Mark





On Wednesday, March 1, 2017 at 4:17:39 PM UTC-8, Dave wrote:
>
> I've realized on another thread that I must have a fundamental 
> misunderstanding of the set widget.  Isn't it supposed to set a variable 
> for use elsewhere?
>
> \define mymacro()
> <$set name="result" value="Hi Bob"/>
> <result>
> $result$
> $(result)$
> \end
>
> <<mymacro>>
>
> When I run the above macro, all I get is 
>
> $result$
>
>
> I also tried it like this
> <$set name="result" text="Hi Bob"/>
>
> but got the same results.
>
> I have got set widget to work in situations like this:
> <$list filter="[<result>getindex[$testname$]]">
>
> but not sure what the distinction is there (set variables only work inside 
> widgets?)
>
>
> Anyway, is there a correct way to get it to work the way I need? or 
> perhaps is there an alternate widget to use?
>
>
> (My ultimate goal is to get a result from inside one macro and transfer it 
> to another macro for further processing.)
>
> Thanks,
> Dave
>
>
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/bfbe33c6-10f6-4ff3-bbd6-956e36983a03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to