Tags:
tag this topic
create new tag
view all tags
#VarSET ---+++ SET{"name" value="..."} -- set a variable * Set a named variable that can be retrieved later with =%<nop>GET{}%=. No output is shown, e.g. =%<nop>SET{}%= resolves to an empty string. It is also possible to set a JSON object using a JSON path. %IF{"'%INCLUDINGTOPIC%'!='SetGetPlugin'" then="The =%<nop>SET{}<nop>%= and =%<nop>GET{}<nop>%= variables are handled by the SetGetPlugin." }% * Syntax: =%<nop>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) | | =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. [[SetGetPlugin#RememberNotes][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. [[SetGetPlugin#RememberNotes][See important notes]]. | =""= | * Example: =%<nop>SET{"lunch" value="Sushi"}%=%IF{"'%INCLUDINGTOPIC%'!='SetGetPlugin'" then=" - [[SetGetPlugin#SetGetExamples][see more examples]]." }% * JSON Syntax: =%<nop>SET{ name = { ... } remember="1" }%=%IF{"'%INCLUDINGTOPIC%'!='SetGetPlugin'" then=" - [[SetGetPlugin#JsonObjects][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: * =%<nop>SET{ menu = { "File": { "New": [ "new", "F" ], "Open": [ "open", "F" ] }, "Edit": { "Copy": [ "cpy", "F" ], "Paste": [ "pst", "F" ] } } }%= - set a JSON object * =%<nop>GET{ menu }%= - returns: ={"File":{"New":["new","F"],"Open":["open","F"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"]}}= * =%<nop>SET{ menu.File.Open[1] = "T" }%= - modify a JSON object * =%<nop>GET{ menu }%= - returns: ={"File":{"New":["new","F"],"Open":["open","T"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"]}}= * =%<nop>SET{ menu.Edit.Cut = [ "cut", "T" ] }%= - add to a JSON object * =%<nop>GET{ menu }%= - returns: ={"File":{"New":["new","F"],"Open":["open","T"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"],"Cut":["cut","T"]}}= * Category: ApplicationsAndComponentsVariables, DevelopmentVariables * Related: [[%IF{"'%INCLUDINGTOPIC%'='TWikiVariables' OR '%INCLUDINGTOPIC%'='SetGetPlugin'" then="#"}%VarGET][GET]], [[%IF{"'%INCLUDINGTOPIC%'='TWikiVariables'" then="#"}%VarIF][IF]], [[%IF{"'%INCLUDINGTOPIC%'='TWikiVariables' OR '%INCLUDINGTOPIC%'='SetGetPlugin'" then="#"}%VarSETGETDUMP][SETGETDUMP]], %IF{"'%INCLUDINGTOPIC%'!='SetGetPlugin'" then="SetGetPlugin, "}%SpreadSheetPlugin#FuncSET
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r4 - 2015-04-08
-
TWikiContributor
Home
Site map
Main web
Sandbox web
TWiki web
TWiki Web
User registration
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
User Reference
ATasteOfTWiki
TextFormattingRules
TWikiVariables
FormattedSearch
QuerySearch
TWikiDocGraphics
TWikiSkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
InterWikis
ManagingUsers
ManagingWebs
TWikiSiteTools
TWikiPreferences
WebPreferences
Categories
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Account
Log In
E
dit
A
ttach
Copyright © 1999-2025 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
.