Difference: VarSET (1 vs. 4)

Revision 42015-04-08 - TWikiContributor

Line: 1 to 1
 
META TOPICPARENT name="TWikiVariables"

SET{"name" value="..."} -- set a variable

Changed:
<
<
  • Set a named variable that can be retrieved later with %GET{}%. No output is shown, e.g. %SET{}% resolves to an empty string. The %SET{}% and %GET{}% variables are handled by the SetGetPlugin.
>
>
  • Set a named variable that can be retrieved later with %GET{}%. No output is shown, e.g. %SET{}% resolves to an empty string. It is also possible to set a JSON object using a JSON path. The %SET{}% and %GET{}% variables are handled by the SetGetPlugin.
 
  • Syntax: %SET{ "name" value="..." remember="1" }%
  • Parameters:
    Parameter Description Default
    <-- -->
    "name" Name of variable. Alphanumeric characters, dashes and underscores can be used. (required)
    value="..." Value of variable. Escape double quotes with backslash. (required, may be empty)
Changed:
<
<
remember="1" If set, the variable will be stored persistently so that it can be used later in any TWiki topic. See important notes. "0"
>
>
remember="1" If set, the variable will be stored persistently so that it can be used later in any TWiki topic. Alternatively use the store parameter. See important notes. "0"
store="..." Specify a store name to persistently store the variable, such as store="Parts". Use alphanumeric characters, dashes and underscores for the name. For better performance, store is preferred over the remember parameter if you need to store a large dataset. See important notes. ""
 
Added:
>
>
  • JSON Syntax: %SET{ name = { ... } remember="1" }% - see description.
    • An optional remember="1" or store="..." parameter can be appended. If specified, the JSON object will be stored persistently so that it can be used later in any TWiki topic.
  • Example to set, modify and get a JSON object:
    • %SET{ menu = { "File": { "New": [ "new", "F" ], "Open": [ "open", "F" ] }, "Edit": { "Copy": [ "cpy", "F" ], "Paste": [ "pst", "F" ] } } }% - set a JSON object
    • %GET{ menu }% - returns: {"File":{"New":["new","F"],"Open":["open","F"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"]}}
    • %SET{ menu.File.Open[1] = "T" }% - modify a JSON object
    • %GET{ menu }% - returns: {"File":{"New":["new","F"],"Open":["open","T"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"]}}
    • %SET{ menu.Edit.Cut = [ "cut", "T" ] }% - add to a JSON object
    • %GET{ menu }% - returns: {"File":{"New":["new","F"],"Open":["open","T"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"],"Cut":["cut","T"]}}
 

Revision 32012-11-13 - TWikiContributor

Line: 1 to 1
 
META TOPICPARENT name="TWikiVariables"

SET{"name" value="..."} -- set a variable

  • Set a named variable that can be retrieved later with %GET{}%. No output is shown, e.g. %SET{}% resolves to an empty string. The %SET{}% and %GET{}% variables are handled by the SetGetPlugin.
  • Syntax: %SET{ "name" value="..." remember="1" }%
Changed:
<
<
>
>
 
"name" Name of variable. Alphanumeric characters, dashes and underscores can be used. (required)
value="..." Value of variable. Escape double quotes with backslash. (required, may be empty)
remember="1" If set, the variable will be stored persistently so that it can be used later in any TWiki topic. See important notes. "0"
Added:
>
>
 

Revision 22012-01-06 - TWikiContributor

Line: 1 to 1
 
META TOPICPARENT name="TWikiVariables"

SET{"name" value="..."} -- set a variable

Line: 10 to 10
 
value="..." Value of variable. Escape double quotes with backslash. (required, may be empty)
remember="1" If set, the variable will be stored persistently so that it can be used later in any TWiki topic. See important notes. "0"
Changed:
<
<
>
>

Revision 12011-04-04 - TWikiContributor

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="TWikiVariables"

SET{"name" value="..."} -- set a variable

  • Set a named variable that can be retrieved later with %GET{}%. No output is shown, e.g. %SET{}% resolves to an empty string. The %SET{}% and %GET{}% variables are handled by the SetGetPlugin.
  • Syntax: %SET{ "name" value="..." remember="1" }%
  • Supported attributes:
    Attribute Comment Default
    "name" Name of variable. Alphanumeric characters, dashes and underscores can be used. (required)
    value="..." Value of variable. Escape double quotes with backslash. (required, may be empty)
    remember="1" If set, the variable will be stored persistently so that it can be used later in any TWiki topic. See important notes. "0"
  • Example: %SET{"lunch" value="Sushi"}% - see more examples.
  • Related: GET, IF, SetGetPlugin, SpreadSheetPlugin#FuncSET
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.VarSET.