You are here: Foswiki>System Web>Category>UserDocumentationCategory>Macros>VarSET (2023-08-06, UnknownUser)Edit Attach
A preference setting created via %SET{}%
will only be usable in the topic where it has been found by the parser, similar to normal preference settings.
When used in an include, note that each call to %INCLUDE opens a new scope for preference variables. An %INCLUDE of another topic containing a %SET{}%
statement will not define those values in the including base topic's scope. However unlike bullet/Meta style preferences, %SET{}%
statements will be active while the INCLUDE is rendered.
If a perference is FINALized in a Bullet/Meta setting, then the %SET{}%
macro will be unable to modify it.
In contrast, a TMPL:DEF
template definition containing %SET{}%
macros will add those values to the current scope as if these settings have been parsed as part of the current topic's text.
A TMPL:DEF
template definition containing %SET
macros will also add those values to the current scope as if these settings have been parsed as part of the base topic's text.
Setting a preference setting in a list like in
* Set foo = %SEARCH{...
or in META settings will store the text of the TML expression.
The equivalent %SET statement:
%SET{"foo" value="%SEARCH{..."}%
will store the result of the TML expression as a consequence of the parser processing macros inside-out-left-to-right.
Parameter | Description | Default |
---|---|---|
"name" | Name of preference to set | |
value | Value to set it to |
To cache the result of another macro use %SET{"search_result" value="%SEARCH{...}%"}%
. The result of the value
expression will be temporarily bound to the variable %search_result%
and might be used within the scope of the current topic being processed, or in %INCLUDing
or other %INCLUDEd
topics.
Note that this macro does NOT expand format tokens that are used to alter the macro processing sequence. ($percent, $dollar, ...).
Edit | Attach | Print version | History: r1 | Backlinks | View wiki text | Edit wiki text | More topic actions
Topic revision: r1 - 2023-08-06, UnknownUser
Copyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback