List and transclude today's tiddlers

203 views
Skip to first unread message

JWHoneycutt

unread,
Jul 28, 2018, 12:46:22 PM7/28/18
to TiddlyWiki

I want to transclude all the tiddlers that start with today's date. I suspect I am handling the variable incorrectly.


<$set name="today" value="<<now YYYY-0MM-0DD >>"/> <!-- I want to set the variable "today" to the day's date in this specific format ie. 2018-07-28 --> <$list filter="[prefix[$(today)$]]"> <$view field="title"/><br> {{<<currentTiddler>>}}<br> </$list> <!-- I want to show title, then transclude contents, if the title starts with today's date -->


Can you help me debug this?


JWHoneycutt

FrD

unread,
Jul 28, 2018, 2:37:05 PM7/28/18
to TiddlyWiki
Hi,

This seems to work, although there may be a simpler solution :

\define day()
<$macrocall $name="now" format="YYYY-0MM-0DD"/>
\end

\define filter()
[prefix[$(today)$]]
\end

<$wikify name="today" text=<<day>>>
<$list filter=<<filter>>>


<$view field="title"/><br>
{{<<currentTiddler>>}}<br>
<
/$list>
</
$wikify>



Regards

FrD

FrD

unread,
Jul 28, 2018, 2:39:40 PM7/28/18
to TiddlyWiki
Sorry,

\define day()
<$macrocall $name="now" format="YYYY-0MM-0DD"/>
\end

\define filter()
[prefix[$(today)$]]
\end

<$wikify name="today" text=<<day>>>
<$list filter=<<filter>>>

<$view field="title"/><br>
{{<<currentTiddler>>}}<br>
</$list>
</
$wikify>



Regards

FrD

HansWobbe

unread,
Jul 28, 2018, 4:40:16 PM7/28/18
to TiddlyWiki
FrD:

That's quite a neat reminder mechanism.  Thanks for sharing. 

Regards,
Hans

Eric Shulman

unread,
Jul 28, 2018, 6:46:43 PM7/28/18
to TiddlyWiki
On Saturday, July 28, 2018 at 9:46:22 AM UTC-7, JWHoneycutt wrote:

I want to transclude all the tiddlers that start with today's date. I suspect I am handling the variable incorrectly.

Can you help me debug this?


1) To use the result of the <<now>> macro as a parameter value, omit the quotes surrounding value=...
2) The <$set> widget should NOT use the "closing slash" syntax.  Instead, you need to use the matching </$set> at the end of the code.  The variable is only defined within the scope of the <$set>...</$set>
3) You can only use the $(today)$ syntax within a macro definition, so filter="[prefix[$(today)$]" won't work.  However, there is a direct filter syntax for referencing values in variables, so you can write filter="[prefix<today>]"
4) You can't combine the {{...}} transclusion syntax with the <<variable>> reference.  Instead, to transclude the content from the currentTiddler, use the <$transclude> widget.  You can omit the tiddler=... parameter from that widget, since it defaults to the currentTiddler.  Thus:

<$set name="today" value=<<now YYYY-0MM-0DD>
>>
   <$list filter="[prefix
<today>]">
      <$view field="title"/>
<br>
      <$transclude />
<br>
   </$list>
<$set>

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals

TonyM

unread,
Jul 28, 2018, 8:32:55 PM7/28/18
to TiddlyWiki
And for the listing of dates you can also use the sameday filter operator against othe date fields.

Sameday[-7] will show dates with the sameday or 7 days earlier.

Tony

Mark S.

unread,
Jul 28, 2018, 8:39:31 PM7/28/18
to TiddlyWiki
I think you mean the "days" operator. Remember that the sameday operator is buggy when using hand-made local dates.

-- Mark

TonyM

unread,
Jul 28, 2018, 8:52:05 PM7/28/18
to TiddlyWiki
Mark,

Thanks for pointing out my error, I should post from my desktop, not the mobile.

"[!days:weekly-review[-7]]"

Also Rather than manual dates I tend to timestamp them with the full format 
<$action-setfield $field=$fieldname$ $value=<<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>>/>

or use Pikaday https://github.com/dbushell/Pikaday and use the field format
fieldFormat="[UTC]YYYY0MM0DD0hh0mm0ssxxx"/>

Regards
Tony

Mark S.

unread,
Jul 28, 2018, 11:42:09 PM7/28/18
to TiddlyWiki


On Saturday, July 28, 2018 at 5:52:05 PM UTC-7, TonyM wrote:
Also Rather than manual dates I tend to timestamp them with the full format 
<$action-setfield $field=$fieldname$ $value=<<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>>/>

Yes, that's probably the best way to use them. But the documentation does "invite" the user to roll their own dates like YYYYMMDD, so it ought to work (or the documentation should be changed).

Thanks!
-- Mark

TonyM

unread,
Jul 29, 2018, 3:59:28 AM7/29/18
to TiddlyWiki
Agreed and it does work but is fragile as far as i can see, and utc timezone format importiant to me at +10

Tony

JWHoneycutt

unread,
Aug 4, 2018, 9:15:39 AM8/4/18
to TiddlyWiki
@ Eric Shulman - your work is always so elegant, I wish your missing manual (for TW5) had more information about syntax, strings, variables, etc.

@ TonyM - you accurately predicted where I was going next. My ideal state is "Today's tiddlers" listed, with the last X day's listings collapsed above, and {{Due soon}} below.

I am using Eric's code for today's titled tiddlers:

<$set name="today" value=<<now YYYY-0MM-0DD>> 
>
   <$list filter="[prefix<today>]">
     '' <$view field="title"/><br>''
      <$transclude /><br><br>
   </$list>
<$set>

How do I incorporate the filter operator you proposed ?

"[!days:weekly-review[-7]]"

 
Here is my latest attempt (to simply provide yesterday's tiddlers):

<$set name="today" value=<<now YYYY-0MM-0DD>> 
>
   <$list filter="<today>[days:title[-1]]">
     '' <$view field="title"/><br>''
      <$transclude /><br><br>
   </$list>
<$set>

{{Due}}

In the filter run, I don't know how to "mix and match" the variable <today> with the filter operator:suffix [parameter] days:title[-1] since <today> is now a defined string, not a date

Any debug ideas?

JWHoneycutt

(and a pre-emptive Thank you)


Reply all
Reply to author
Forward
0 new messages