Count no. of negative or positive numbers in field

Hi,

I’m trying the various options in the docs to play around with the following in order to list the tiddlers with positive numbers in field ‘R’ and another list with negative numbers in field ‘R’ but not having any luck.

{{{ [tag[current]] :filter[get[R]length[]compare:number: gt[1]] }}}

Ideally, I’d like to count the number in each list.

Regards
Jon

Try

{{{ [all[tiddlers]] :filter[get[R]compare:number:gt[0]] }}}

and

{{{ [all[tiddlers]] :filter[get[R]compare:number:lt[0]] }}}

1 Like

Thanks, Saq - yes, that works.

Do you know how I can count them as well?

Note that you probably want to replace [all[tiddlers]] with [tag[current]] or [tag<currentTiddler>] if that accurately identifies the tiddlers in questions.

to count them add an additional filter run at the end:
:and[count[]]

example:
{{{ [tag[current]] :filter[get[R]compare:number:gt[0]] :and[count[]] }}}

1 Like

Brilliant!

Many thanks
Jon