Документ взят из кэша поисковой машины. Адрес оригинального документа :
http://wiki.cmc.msu.ru/System/VarQUERY?raw=on
Дата изменения: Unknown
Дата индексирования: Sun Apr 10 04:36:43 2016
Кодировка: koi8-r
You are here:
Foswiki
>
System Web
>
Macros
>
VarQUERY
(19 Sep 2010,
ProjectContributor
)
(raw view)
E
dit
A
ttach
#VarQUERY ---+++ QUERY -- get the value of meta-data * Uses the query syntax described in [[%SYSTEMWEB%.QuerySearch][QuerySearch]] to get information about meta-data. * 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. * Syntax: =%<nop>QUERY{ "query" }%= * See !QuerySearch for more details of how to write queries * Parameters: * =style="stylename"= - set the output format (see below) * =rev="version"= - 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 be returned as Perl code strings generated by running through CPAN:Data::Dumper. You can make the macro generate different output formats using the =style= parameter: * =style="perl"= - generates values as Perl code strings * =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=", "}% * Related: [[%IF{"'%INCLUDINGTOPIC%'='Macros'" then="#"}%VarMETA][META]] [[%IF{"'%INCLUDINGTOPIC%'='Macros'" then="#"}%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 - 19 Sep 2010,
ProjectContributor
System
Log In
Toolbox
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
User Reference
BeginnersStartHere
TextFormattingRules
Macros
FormattedSearch
QuerySearch
DocumentGraphics
SkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
AdminToolsCategory
InterWikis
ManagingWebs
SiteTools
DefaultPreferences
WebPreferences
Categories
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Webs
CMCZone
Lectures
Main
Practicum
PracticumV
Sandbox
System
Deutsch
English
Suomi
한글
Norsk
Português brasileiro
Русский
Copyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki?
Send feedback