Set count limit in nested list widget?

I want to tweak the system macro timeline a little bit. Here is the code as you can see there are two list widgets in it. Outer list widget loop the date, and inner list loop the specific tids.

If you add keyword count on each. You can limit the count of date or the count of the tids in specific date.

What I want now is count them all and ignore date, let say I want 20 tids list out.
If Today have 15 and yesterday has 20, the final list will get all tids in today and top 5 in yesterday.

And I dont want to break the structure. how to make it?

Name of the tid need modified: $:/core/macros/timeline

\define timeline-title()
\whitespace trim
<!-- Override this macro with a global macro 
     of the same name if you need to change 
     how titles are displayed on the timeline 
     -->
<$view field="title"/>
\end
\define timeline(limit:"100",format:"DDth MMM YYYY",subfilter:"",dateField:"modified")
<div class="tc-timeline">
<$list filter="[!is[system]$subfilter$has[$dateField$]!sort[$dateField$]limit[$limit$]eachday[$dateField$]]">
<div class="tc-menu-list-item">
<$view field="$dateField$" format="date" template="$format$"/>
<$list filter="[sameday:$dateField${!!$dateField$}!is[system]$subfilter$!sort[$dateField$]!limit[10]]">
<div class="tc-menu-list-subitem">
<$transclude tiddler={{!!icon}}/> <$link to={{!!title}}><<timeline-title>></$link>
</div>
</$list>
</div>
</$list>
</div>
\end

I would consider making yesterday and today tabs :face_with_raised_eyebrow:

Ok I may make the question stupid,

The reason I need this is:
After make some tweak of the tw, the sidebar got something wrong, the tab and title will get out of the view of the page after scroll. I dont know how to change it back. I found that if limit the number of the recently tids, there is no need to scroll so the title and tab can stay there. Also make it since if the ““recent tab”” get too many tids, I wont see it. I just remember the last 10 tids I just used normally. So I ask the question like this, yes, it looks a little stupid if the sidebar no problem.

Before Scroll:

After scroll:

! so my question leads to two direction

  1. set the count of the nest list widget
  2. how to stick the tab and title on sidebar as before…

:smile:

Give this a try:

\define mytimeline(limit:"100",format:"DDth MMM YYYY",subfilter:"",dateField:"modified")
<$set name="tids" filter="[!is[system]$subfilter$has[$dateField$]!sort[$dateField$]limit[$limit$]]">
<div class="tc-timeline">
<$list filter="[enlist<tids>eachday[$dateField$]]">
<div class="tc-menu-list-item">
<$view field="$dateField$" format="date" template="$format$"/>
<$list filter="[enlist<tids>sameday:$dateField${!!$dateField$}]">
<div class="tc-menu-list-subitem">
<$link to={{!!title}}><$view field="title"/></$link>
</div>
</$list>
</div>
</$list>
</div>
\end

You can invoke the above using:
<<mytimeline limit:20>>

Notes:

  1. The macro starts by getting the list of tiddlers, sorted in descending order by dateField, limited to the desired number of tiddlers and saves this list in a variable named tids
  2. Then, the subsequent filters use enlist<tids> to operate only on this list of tiddlers.

enjoy,
-e

2 Likes