Help with a filter

Hi,

I’ve got a table with the week number and a value for that week (R)

I’d like to show R for the current week.

I’ve managed to use this to display the current week by showing the highest number (although there might be a better way)

<$list filter=" [tag[test]get[week]maxall[]] ">

But after looking through the docs I can’t figure out how to attach the other part of the filter to show the value of R for the current week.

Thanks
Jon

Assuming that R is a field, take a look at Filter Filter Run Expression .

Yep, had a look in there but doing my William Burroughs cut ups hasn’t produced anything working yet e.g.

<$list filter=" [tag[test]get[week]maxall[]: filter[get[R]sum[]] ">
1 Like

Try this:

<$list filter="[tag[test]sort[week]last[]]">
   Current Week: {{!!title}}, Value: {{!!R}}
</$list>

Notes:

  • tag[test] gets a list of all the tiddler titles that are tagged with test
  • sort[week] sorts the list of titles in ascending order by the value of their week field. Note that this does NOT result in a list of week numbers. It just uses the week numbers to sort the list of titles.
  • last[] keeps only the last title, which will be the current week, since it has the highest week number
  • The $list widget sets the currentTiddler variable to the result of the filter, so that within the content of the $list widget you can use simple transclusion syntax to show the values of the title and R fields.

enjoy,
-e

1 Like

Thanks Eric!

and for the explanation which I’ll squirrel away for next time.