Funny thing is that in the process of figuring that out I managed to
implement by myself a cool real-time filter for my table.
I thought this would take ages to do.
Meanwhile, I can't figure out how to implement this thing I thought would
be very simple (have a filter that outputs only tiddlers where a field is
within a certain numerical range).
On Tuesday, June 16, 2020 at 4:47:58 PM UTC+1, OGNSYA wrote:
>
> That works, thanks!
>
> Could it be all done within the filter?
> I want to use it as a filter for a TiddlyTables table. I think I can only
> configure a filter there. (see image attached)
>
> Thanks for explaining things to me. I did read Eric's email. But I'm a
> beginner in TW , and not a strong coder (I can do very simple JS/HTML), so
> the language is still quite overwhelming to me.
>
>
> On Tuesday, June 16, 2020 at 4:06:04 PM UTC+1, Saq Imtiaz wrote:
>>
>> <$list filter="[has[importance]]">
>>
>> {{{ [{!!importance}compare:number:gteq[5]then{!!title}] }}}
>>
>> </$list>
>>
>> I also recommend you re-read what Eric has explained above regarding
>> brackets in filters.
>>
>> On Tuesday, June 16, 2020 at 4:41:26 PM UTC+2, OGNSYA wrote:
>>>
>>> Thanks Saq.
>>>
>>> I tried your suggestion and it did the filtering, however the output
>>> doesn't seem to be the actual tiddler list.
>>>
>>> First, here's a simpler example that works for me:
>>> <$list filter="[importance[5]]"><$view field="title"/><br/></$list>
>>>
>>> This correctly outputs a list of all tiddlers with *importance* field
>>> equal to 5.
>>> Tiddler A
>>> Tiddler B
>>> Tiddler D
>>> Tiddler G
>>> etc.
>>>
>>> Below, my attempt to show all tiddlers with *importance* equal or
>>> greater than 5, based on the code you suggested:
>>> <$list filter="[get[importance]compare:number:gteq[5]]"><$view
>>> field="title"/><br/></$list>
>>>
>>> This returns a list of numbers, corresponding to the importance field,
>>> for each tiddler.
>>> 8
>>> 10
>>> 6
>>> 5
>>> 8
>>> (etc...)
>>>
>>> That is actually correct, considering it's only showing numbers 5 and
>>> above. However I'd like the output to be the tiddlers themselves (as in my
>>> simple example).
>>> I'm probably doing something wrong. I just don't know what..
>>>
>>> I also tried this:
>>> <$list
>>> filter="[importance[[get[importance]compare:number:gteq[5]]]]"><$view
>>> field="title"/><br/></$list>
>>>
>>> But it returns:
>>> Filter error: Syntax error in filter expression
>>>
>>>
>>>
>>> On Tuesday, June 16, 2020 at 2:40:53 PM UTC+1, Saq Imtiaz wrote:
>>>>
>>>> try [get[importance]compare:number:gteq[5]]
>>>>
>>>> this assumes you want to compare a field with name importance
>>>>
>>>> On Tuesday, June 16, 2020 at 1:07:28 PM UTC+2, OGNSYA wrote:
>>>>>
>>>>> Thanks for that Eric.
>>>>> For some reason it didn't work for me...
>>>>>
>>>>> This simple case works, for showing all tiddlers with importance set
>>>>> as 5:
>>>>> (note I changed the field name from *priority* to *importance*)
>>>>> [importance[5]]
>>>>>
>>>>> I tried this, for showing all tiddlers with importance 5 or higher:
>>>>> [importance[{!!importance}compare:number:gteq[5]]]
>>>>>
>>>>> I also tried just this:
>>>>> [{!!importance}compare:number:gteq[5]]
>>>>>
>>>>>
>>>>> On Tuesday, June 16, 2020 at 11:33:20 AM UTC+1, Eric Shulman wrote:
>>>>>>
>>>>>> On Tuesday, June 16, 2020 at 3:04:46 AM UTC-7, OGNSYA wrote:
>>>>>>>
>>>>>>> Thanks! I did see that, but couldn't figure out how to actually use
>>>>>>> it.
>>>>>>> Let's say I want to filter only tiddlers where the custom field
>>>>>>> *priority* is 5 or greater.
>>>>>>>
>>>>>>
>>>>>> Give this a try:
>>>>>> [{!!priority}compare:number:gteq[5]]
>>>>>>
>>>>>> Note that, in filter syntax, you use *single* brackets around
>>>>>> references,
>>>>>> and except for the outermost square brackets around the whole filter
>>>>>> run,
>>>>>> the brackets are part of the reference itself, where
>>>>>> *[...] is for literal values, {...} is for field values, and <...> is
>>>>>> for variables*
>>>>>>
>>>>>> So, for example, in addition to the above syntax for comparing with a
>>>>>> literal value of "5",
>>>>>> you could compare with a value stored in another field:
>>>>>> [{!!priority}compare:number:gteq{!!minimum}]
>>>>>> or with a value from a variable:
>>>>>> <$vars minimum="5">
>>>>>> [{!!priority}compare:number:gteq<minimum>]
>>>>>> </$vars>
>>>>>>
>>>>>> hope this helps,
>>>>>>
>>>>>> enjoy,
>>>>>> -e
>>>>>>
>>>>>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/6f73a480-72ef-40e8-8ac5-1e52046bbdc6o%40googlegroups.com.