*
You are here:
Iris Wiki
>
System Web
>
Category
>
UserDocumentationCategory
>
Macros
>
VarQUERY
(20 Dec 2016,
ProjectContributor
)
(raw view)
Edit
Attach
---+ QUERY -- get the value of meta-data Uses the query syntax described in [[%SYSTEMWEB%.QuerySearch][QuerySearch]] to get information about meta-data from one specified topic. * supports formatted access to formfields and other meta-data in topics using the same syntax as is used in =IF= and =SEARCH= statements, * gives access to *all* meta-data, including that added by extensions, * supports reporting values using JSON and other standards, simplifying the retrieval of meta-data for REST applications, * replaces the =[[VarFORMFIELD][FORMFIELD]]= macro for most applications. See !QuerySearch for more details of how to write queries ---++ Parameters | *Parameter* | *Description* | *Default* | | ="item"= | The meta-data to query | | =style= | set the output format (see below) | | =rev= | operate on the given version of the current topic. Note that this will _only_ affect simple queries that refer to the current topic, such as =form.name=. More complex queries that use searches or indirection to refer to other topics always use the *latest* version of those topics. | ---++ Examples <pre class="tml"> Get the name of the form in the current topic: %<nop>QUERY{"form.name"}% Get the value of the 'Firstname' form field in the current topic: %<nop>QUERY{"fields[name='Firstname'].value"}% Get the value of the 'Firstname' form field in the current topic (shorthand version): %<nop>QUERY{"Firstname"}% Get a list of all the names of attachments on the topic '%SYSTEMWEB%.DocumentGraphics': %<nop>QUERY{"'%SYSTEMWEB%.DocumentGraphics'/attachments.name"}% Get configuration setting {NameFilter}: %<nop>QUERY{"{NameFilter}"}% </pre> Plain strings (such as field values) are returned _without_ quotes. Simple arrays of scalars are also returned without quotes, in a comma-separated list (beware of values that contain commas!). More complex data structures (e.g. arrays of hashes) will only be returned if =style="perl"= or =style="json"= are set - else will return a string containing 'undef'. You can make the macro generate different output formats using the =style= parameter: * =style="perl"= - generates values as Perl code strings generated by running through CPAN:Data::Dumper * =style="json"= - generates values as JSON strings, suitable for reading by browsers. Only some configuration settings are available via QUERY: %FORMAT{"%QUERY{"{AccessibleCFG}"}%" type="string" format="=$item=" separator=", "}% %STOPINCLUDE% ---++ Related [[VarMETA][META]] [[QuerySearch][QuerySearch]] <!--%JQREQUIRE{"chili"}%-->
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Edit
w
iki text
|
M
ore topic actions
Topic revision: r1 - 20 Dec 2016,
ProjectContributor
System
Log In
Register
Toolbox
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Preferences
User Reference
BeginnersStartHere
EditingShorthand
Macros
MacrosQuickReference
FormattedSearch
QuerySearch
DocumentGraphics
SkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
AdminToolsCategory
InterWikis
ManagingWebs
SiteTools
DefaultPreferences
WebPreferences
Categories
AdminDocumentationCategory
AdminToolsCategory
DeveloperDocumentationCategory
UserDocumentationCategory
UserToolsCategory
Webs
Ab
Ar
Bb
Gdn
Hist
Ib
Ird
Ji
La
Main
Bio
Mdb
Spx
Mtb
Pcn
Sandbox
Sdb
Sib
Spec
Spu
System
TbAthruE
TbFthruJ
TbKthruO
TbPthruT
TbUthruZ
Copyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Iris Wiki?
Send feedback