[tw5] Re: Cannot use a variable from a filter. Can someone help me ?

2021-09-24 Thread Jean-Pierre Rivière
Yes it does trigger a javascript exception.

The following code does the things you want, if I have well understood your 
goal.

<$vars target="<>">
<$wikify name=todayfilter text="
 [get[task_date]match[<>]]">
<> : <>



<$list filter="[regexp[db___]!sort[task_start_time]filter]">

<$link><$view field="task_date"/>
<$view field="tags"/>
<$view field="task_comment"/>
<$view field="task_start_time"/>
<$view field="task_end_time"/>





Le lundi 23 août 2021 à 14:37:20 UTC+2, vpl a écrit :

> You are obviously right ... thanks
> But even with that *I still get an Tiddly exception*
> FOr your convenience I've prepared a small tiddly with the code (tiddler 
> test) as an attachment
>
> Open the *test *tiddler and replace the 
> <$vars todayfilter="[get[task_date]match[2021-08-23]]">
> by
> <$vars todayfilter="[get[task_date]match]">
>
> You will get a javascript exception as I mentioned in the previous posts 
> of this conversation
>
> Is it a bug ?
>
> Thanks for your help
>
> Regards
>
> Le lundi 23 août 2021 à 14:25:36 UTC+2, Eric Shulman a écrit :
>
>> On Monday, August 23, 2021 at 5:13:22 AM UTC-7 vpl wrote:
>>
>>> Thanks a lot; I agree for 1), 3) and 4)
>>> But for point 2) in fact what I need to do is the following code 
>>> <$vars now_date=<>>
>>> <>
>>> <$vars todayfilter="[get[task_date]match]">
>>>
>> I use the *filter *operator into the list as I want to filter the 
>>> tiddlers based on the *task_date * field
>>> For each of the filtered tiddlers I display the fields in the table
>>>
>>
>> Ah, yes...I see now.  You *do* want to find *all* tiddlers that have a 
>> "task_date" field, not just check the current tiddler.
>>
>> More, When I try the below code I get a Tiddler exception (attached in my 
>>> previous post ...)
>>>
>> Is there a bug in the *filter *operator or something wrong I'm doing ?
>>>
>>
>> I think you missed a change on line 1.  Instead of:
>> <$vars now_date=<>>
>> you want:
>> <$vars target=<>> 
>>
>> -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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3d7aceab-6219-427b-b033-0d769bb2db6an%40googlegroups.com.


[tw5] Re: Cannot use a variable from a filter. Can someone help me ?

2021-08-23 Thread Eric Shulman
On Monday, August 23, 2021 at 5:13:22 AM UTC-7 vpl wrote:

> Thanks a lot; I agree for 1), 3) and 4)
> But for point 2) in fact what I need to do is the following code 
> <$vars now_date=<>>
> <>
> <$vars todayfilter="[get[task_date]match]">
> I use the *filter *operator into the list as I want to filter the 
> tiddlers based on the *task_date * field
> For each of the filtered tiddlers I display the fields in the table
>

Ah, yes...I see now.  You *do* want to find *all* tiddlers that have a 
"task_date" field, not just check the current tiddler.

More, When I try the below code I get a Tiddler exception (attached in my 
> previous post ...)
>
Is there a bug in the *filter *operator or something wrong I'm doing ?
>

I think you missed a change on line 1.  Instead of:
<$vars now_date=<>>
you want:
<$vars target=<>> 

-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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a9e21ba9-7c2c-4202-9af0-c21908654c6cn%40googlegroups.com.


[tw5] Re: Cannot use a variable from a filter. Can someone help me ?

2021-08-23 Thread vpl
Hi,
Thanks a lot; I agree for 1), 3) and 4)

But for point 2) in fact what I need to do is the following code 
<$vars now_date=<>>
<>
<$vars todayfilter="[get[task_date]match]">
<$list filter="[regexp[db___]!sort[task_start_time]filter]">

<$link><$view field="task_date"/>
<$view field="tags"/>
<$view field="task_comment"/>
<$view field="task_start_time"/>
<$view field="task_end_time"/>




I use the *filter *operator into the list as I want to filter the tiddlers 
based on the *task_date * field
For each of the filtered tiddlers I display the fields in the table
If I put the "get[task_date]" directly into my final filter  like that (<$list 
filter="[regexp[db___]!sort[task_start_time] [get[task_date]match ">) 
I do not have the tiddler fields to display

More, When I try the below code I get a Tiddler exception (attached in my 
previous post ...)

Is there a bug in the *filter *operator or something wrong I'm doing ?

Regards




Le lundi 23 août 2021 à 13:45:27 UTC+2, Eric Shulman a écrit :

> On Sunday, August 22, 2021 at 1:24:58 PM UTC-7 vpl wrote:
>
>> I'm trying to run the following code (at the end of the message) which 
>> uses a variable called 'target' (that contains the current date) into a 
>> filter called todayfilter
>>
> \define now_val()
>> <$vars now_date=<>>
>> <$vars  target={{{ [] }}}>
>> <>
>> <$vars todayfilter="[get[task_date]compare:string:eg[]]">
>>
>
> Replace the first four lines of the macro with these three lines:
> <$vars target=<>>
> <>
> <$vars todayfilter="[get[task_date]match]">
>
> Notes:
> 1) Assign the date to the target variable in one step.  There's no need 
> for "now_date".
> 2) The filter needs  preceding get[task_date], otherwise 
> it will get the task_date value from *every* tiddler that has that field!
> 3) The compare "mode" should be "eq" (abbreviation of "equal") not "eg".
> 4) For a simple string comparison, you can use the "match" filter operator.
>
> Let me know how it goes,
>
> 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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6867f42a-98bb-4fed-b101-44b1ebb82ec6n%40googlegroups.com.


[tw5] Re: Cannot use a variable from a filter. Can someone help me ?

2021-08-23 Thread Eric Shulman
On Sunday, August 22, 2021 at 1:24:58 PM UTC-7 vpl wrote:

> I'm trying to run the following code (at the end of the message) which 
> uses a variable called 'target' (that contains the current date) into a 
> filter called todayfilter
> \define now_val()
> <$vars now_date=<>>
> <$vars  target={{{ [] }}}>
> <>
> <$vars todayfilter="[get[task_date]compare:string:eg[]]">
>

Replace the first four lines of the macro with these three lines:
<$vars target=<>>
<>
<$vars todayfilter="[get[task_date]match]">

Notes:
1) Assign the date to the target variable in one step.  There's no need for 
"now_date".
2) The filter needs  preceding get[task_date], otherwise it 
will get the task_date value from *every* tiddler that has that field!
3) The compare "mode" should be "eq" (abbreviation of "equal") not "eg".
4) For a simple string comparison, you can use the "match" filter operator.

Let me know how it goes,

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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/282316f1-c673-4101-a6a7-d83e7dcdec2dn%40googlegroups.com.


[tw5] Re: Cannot use a variable from a filter. Can someone help me ?

2021-08-22 Thread TW Tones
I just had a quick look at your code

<$vars todayfilter="[get[task_date]compare:string:eg[]]

Try;
vars todayfilter="[all[current]get[task_date]compare:string:eg]"

Tones
On Monday, 23 August 2021 at 06:24:58 UTC+10 vpl wrote:

> Hi,
>
> I'm trying to run the following code (at the end of the message) which 
> uses a variable called 'target' (that contains the current date) into a 
> filter called todayfilter
>
> When I set the  todayfilter 
> <$vars todayfilter="[get[task_date]compare:string:eg[2021-08-22]]">
> All works fine (I mean the list <$list 
> filter="[regexp[db___]!sort[task_start_time]filter]"> 
>
> When I set the  todayfilter using the  variable (as in the code 
> below) this does not works. I've tested several syntax options without 
> success ...
>
> Any expert to tell me when the syntax is wrong ?
> Many thanks , Regards
> Vpl
>
> \define now_val()
> <$vars now_date=<>>
> <$vars  target={{{ [] }}}>
> <>
>
> <$vars todayfilter="[get[task_date]compare:string:eg[]]">
>
> 
>
> DateProjectTaskStartStop
> 
>   
>   //Number of tiddlers//
>   ''<$count 
> filter="[regexp[db___]filter]"/>''
>  
> <$list filter="[regexp[db___]!sort[task_start_time]filter]">
> 
> <$link><$view field="task_date"/>
> <$view field="tags"/>
> <$view field="task_comment"/>
> <$view field="task_start_time"/>
> <$view field="task_end_time"/>
> 
> 
> 
>
> \end
>
> <>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4ee01645-04ac-4d1c-87ac-ef9930b5468cn%40googlegroups.com.