using field values inside day-diff macro

47 views
Skip to first unread message

Dave

unread,
Oct 14, 2019, 10:30:15 PM10/14/19
to TiddlyWiki
This is a question specifically about Jed's day-diff macro: http://inmysocks.tiddlyspot.com/#Date%20Macro%20Demos

but it may have a more general application about using field values in macros generally



if I do this

<<day-diff 2019 10 14 2019 11 14>> days


I get this

31 days



but if I try these, none of them work:

<<day-diff {{mynow!!mynow}} 2019 11 14>> days

<
<day-diff {mynow!!mynow} 2019 11 14>> days


where the tiddler "mynow" has a field called "mynow" that has value of "2019 10 14"





I also tried (didn't work):

\define mynowtext()
<$view title="mynow" field="mynow"/>
\end


<<day-diff <<mynowtext\>\> 2019 11 14>> days

thanks,
- Dave

Dave

unread,
Oct 14, 2019, 10:37:18 PM10/14/19
to TiddlyWiki
P.S. just realized 

<$view title="mynow" field="mynow"/>

should have been 

<$view tiddler="mynow" field="mynow"/>

but that didn't work either

TonyM

unread,
Oct 14, 2019, 10:58:37 PM10/14/19
to TiddlyWiki
Dave,

Also, If you want to pass transclusions, text references and variables into a macro like your first post, have a look at the $macrocall widget, because this allows you to have parmetername=value where value can be a variable or transclusion.

<$macrocall $name=macroname title={{mynow}} field=<<variable>> />


Regards
Tony

TonyM

unread,
Oct 14, 2019, 11:01:36 PM10/14/19
to TiddlyWiki
Post script;

If you need to concatenate something to get it into a parameter you usually cant do it inside the macro call widget's parameters, instead do this

\define variable(b) value$(variableA)$ $b$ and more

<$macrocall $name=macroname title={{mynow}} field=<<variable>> />

Regards
Tony

On Tuesday, October 15, 2019 at 1:37:18 PM UTC+11, Dave wrote:
P.S. just realized 

On Tuesday, October 15, 2019 at 1:58:37 PM UTC+11, TonyM wrote:
Dave,

Also, If you want to pass transclusions, text references and variables into a macro like your first post, have a look at the $macrocall widget, because this allows you to have parmetername=value where value can be a variable or transclusion.

<$macrocall $name=macroname title={{mynow}} field=<<variable>> />
<$view title="mynow" field="mynow"/>

Dave

unread,
Oct 15, 2019, 1:31:21 AM10/15/19
to TiddlyWiki
Thank you Tony, I'll try that out tomorrow.
Reply all
Reply to author
Forward
0 new messages