Using a transclusion with the days operator

Hello

Another rookie question!

I have the following which selects Events that have happened in the last 14 days.

<$list filter=[tag[Event]!days:date[-1]!sort[]]-[!days:date[-14]]>
<$link field="title"/><br>
</$list>

This appears to give the results that I am looking for.

I thought I would change the syntax so that instead of using the fixed values -1 and -14 the values in fields day1 and day2 are used.

I tried the following, but despite having read the guidance on transclusions and brackets, I cannot get the syntax right.

<$list filter=[tag[Event]!days:date[[{!!day1}]]!sort[]]-[!days:date[[{!!day2}]]]>
<$link field="title"/><br>
</$list>

Please can someone point me in the right direction.

Cheers, Rob

In filter syntax, brackets are used to indicate the type of operand handling needed. Square brackets around operands are only used for literal text/numeric values. When referencing a tiddler field, use curly braces. When referencing a variable, use angle brackets. Thus:

  • literal: days:date[-1]
  • variable: days:date<somevar>
  • fields: days:date{!!somefield}

So, in your use-case:

<$list filter=[tag[Event]!days:date{!!day1}!sort[]]-[!days:date{!!day2}]>
<$link field="title"/><br>
</$list>

-e

Brilliant! Thank you @EricShulman.
The explanation was very useful.
Cheers, Rob