Compare field in ListWidget

Hello again,

I’m struggling comparing the value of a field with the value of the previous field in a filter.

<$list filter="[tag[Task]Einteilung[Monat]sort[Fällig]]">
  <$view field="Fällig" format=date template="mmm YY" /><br>
  <$link><$text text={{{ [{!!title}removeprefix[Task:]] }}}/></$link><br>
</$list>

I want the

<$view field=“Fällig” format=date template=“mmm YY” />

only be shown if the value changes. My approach would be to put the value in a variable and compare it in the next loop, but I’m not sure how to do this in Tiddlywiki.

Thanks for your help in advance,

Ben

Hey Ben,

See if this snippet of code gives you some ideas:

<$let values={{{ [[Z]] [[C]] [[B]] [[D]] [[A]] +[sort[]] +[join[;]] }}}>
  <$list filter="[<values>split[;]]" counter=c>
    <$let cm1={{{ [<c>subtract[1]] }}} >
      <<c>>: {{!!title}} <$list filter="[<c>!match[1]]">(Previous = {{{ [<values>split[;]nth<cm1>] }}} )</$list><br>
    </$let>
  </$list>
</$let>

I thought about it a bit more and I think the easier way would be to filter first for the date:

<$list filter="[tag[Task]Einteilung[Monat]sort[Fällig]]+[unique[Fällig]]">

<$view field="Fällig" format=date template="mmm YY" /><br>

</$list>

The result looks like this:

Feb 25

Feb 25

Feb 25

Mar 25

Mar 25

Mar 25

Mar 25

Mar 25

May 25

Sep 25

Dec 26

Dec 28

I hoped to get rid of the duplicates with +[unique[Fällig]], but this didn’t work. Is it the wrong operator?

Thanks in advance,
Ben

unique does not take a parameter. But if you want a list of all Fällig parameters, you can use map first. It might look like this (untested):

<$list filter="[tag[Task]Einteilung[Monat]] :map[get[Fällig]] +[unique[]sort[]]">

<<currentTiddler>>

</$list>

You might also investigate the each operator.