QUERY -- get the value of meta-data

Uses the query syntax described in 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 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

      Get the name of the form in the current topic:
      %QUERY{"form.name"}%

      Get the value of the 'Firstname' form field in
        the current topic:
      %QUERY{"fields[name='Firstname'].value"}%

      Get the value of the 'Firstname' form field in
        the current topic (shorthand version):
      %QUERY{"Firstname"}%

      Get a list of all the names of attachments on
        the topic 'System.DocumentGraphics':
      %QUERY{"'System.DocumentGraphics'/attachments.name"}%

      Get configuration setting {NameFilter}:
      %QUERY{"{NameFilter}"}%

      List all the installed DataForm field types {FormTypes}:
      %QUERY{"{FormTypes}[].types"}%
        
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: {AccessControlACL}{EnableDeprecatedEmptyDeny}, {AccessibleCFG}, {AdminUserLogin}, {AdminUserWikiName}, {AntiSpam}{EmailPadding}, {AntiSpam}{EntityEncode}, {AntiSpam}{HideUserDetails}, {AntiSpam}{RobotsAreWelcome}, {AuthRealm}, {AuthScripts}, {Cache}{Enabled}, {DefaultDateFormat}, {DefaultUrlHost}, {DenyDotDotInclude}, {DisplayTimeValues}, {EnableEmail}, {EnableHierarchicalWebs}, {FormTypes}, {HomeTopicName}, {LeaseLength}, {LeaseLengthLessForceful}, {LinkProtocolPattern}, {LocalSitePreferences}, {LoginNameFilterIn}, {LowerNational}, {MaxRevisionsInADiff}, {MinPasswordLength}, {NameFilter}, {NotifyTopicName}, {NumberOfRevisions}, {PluginsOrder}, {Plugins}{WebSearchPath}, {PluralToSingular}, {Register}{AllowLoginName}, {Register}{Approvers}, {Register}{DisablePasswordConfirmation}, {Register}{EnableNewUserRegistration}, {Register}{NeedApproval}, {Register}{NeedVerification}, {Register}{RegistrationAgentWikiName}, {ReplaceIfEditedAgainWithin}, {ScriptSuffix}, {ScriptUrlPath}, {Site}{Locale}, {Site}{LocaleRegexes}, {SitePrefsTopicName}, {Stats}{TopContrib}, {Stats}{TopicName}, {Stats}{TopViews}, {SuperAdminGroup}, {SystemWebName}, {TemplateLogin}{AllowLoginUsingEmailAddress}, {TemplatePath}, {TrashWebName}, {UploadFilter}, {UpperNational}, {UseLocale}, {UserInterfaceInternationalisation}, {UsersTopicName}, {UsersWebName}, {Validation}{Method}, {WebMasterEmail}, {WebMasterName}, {WebPrefsTopicName}

META QuerySearch
Topic revision: r1 - 04 Jul 2015, UnknownUser

  • User Reference
  • BeginnersStartHere
  • EditingShorthand
  • Macros
  • MacrosQuickReference
  • FormattedSearch
  • QuerySearch
  • DocumentGraphics
  • SkinBrowser
  • InstalledPlugins

  • Admin Maintenance
  • Reference Manual
  • AdminToolsCategory
  • InterWikis
  • ManagingWebs
  • SiteTools
  • DefaultPreferences
  • WebPreferences

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Structural Basis of Medical Practice? Send feedback