Thanks a lot for this detailed answer which is going beyond my current 
expertise and understanding of these languages suptilities
In fact my problem was linked to a button action and thanks to  
https://tiddlytools.com/timer.html code sample I was able to find a work an 
option 

\define tasks_delete()
<$vars  projectId={{{ [<currentTiddler>get[projectId]] }}}>
<$reveal default="show" type="match" text="show">
<$button class="tc-button tt-button" tooltip="delete this alarm"> 
{{$:/core/images/delete-button}}
        <$action-listops $tiddler=<<projectId>> $field="tasks" 
$subfilter="-[[$(this_alarm)$]]" />
  </$button>
</$reveal>
\end

The $reveal seems to be mandatory to get access to my projectId variable 
withing the button action-listops

Thanks a lot for  your help

Regards

Vpl

Le mardi 17 août 2021 à 17:06:55 UTC+2, Soren Bjornstad a écrit :

> vpl,
>
> First of all, the syntax for incorporating a variable into a filter 
> expression is not <<variable>> but <variable>:
>
> \define test_project()     {{{ [<my_tiddler>get[projectId]] }}}
>
> However, this still may not work, depending on how you use the macro. It's 
> tempting to think of macro transclusions as "function calls", where when 
> you say <<test_project>> you get the result of evaluating their contents as 
> wikitext. But this is not how macros work – instead, *the exact text of 
> the macro* (with any $text substitutions$ the macro might include) is 
> inserted wherever the <<macro transclusion>> is used, which in this case is 
> a filter expression in triple curly braces.
>
> Now, this will still work fine if you just say, for instance:
>
> <<test_project>>
>
> In this case, TW replaces <<test_project>> with {{{ 
> [<my_tiddler>get[projectId]] }}}, then sees that wikitext in the body of a 
> tiddler, evaluates it, and gets the project ID. But it won't work if you 
> try to use it within another filter expression, or as the value of an HTML 
> or widget attribute, e.g., suppose you had a tiddler whose title was this 
> project ID and wanted to transclude it:
>
> <$transclude tiddler=<<test_project>>/>
>
> In this case, TW will be looking for a tiddler called "{{{ 
> [<my_tiddler>get[projectId]] }}}", and it presumably won't find it.
>
> If you need to, you can get around this with the $wikify widget:
>
> <$wikify name="myProjectId" text=<<test_project>>>
>   <$transclude tiddler="myProjectId"/>
> </$wikify>
>
> In this case, you explicitly tell TW to evaluate the wikitext "{{{ 
> [<my_tiddler>get[projectId]] }}}", then use the result to transclude the 
> appropriate tiddler.
>
> You can read more on this in the Wikification section 
> <https://groktiddlywiki.com/read/#Wikification> of *Grok TiddlyWiki*.
> On Tuesday, August 17, 2021 at 9:56:51 AM UTC-5 vpl wrote:
>
>> Hi,
>>
>> I want to define a global variable in my script with the value contained 
>> into a tiddler field
>> When I hard code the global variable like
>>
>> \define test_project()     project-1
>>
>> I can use the <<test_project>> variable without issue 
>>
>> But when I want this <<test_project>> to be initialised to a tiddler's  
>> field like the following this does not work
>>
>> \define test_project()     {{{ [<<my_tiddler>>get[projectId]] }}}
>>
>> Any "magic" idea ..??
>>
>> Thanks a lot for your support
>>
>> Regards vpl
>>
>

-- 
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/4a75eee9-5f0a-4464-8af9-05399befe939n%40googlegroups.com.

Reply via email to