QUERY -- get the value of meta-data

  • Uses the query syntax described in 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 FORMFIELD macro for most applications.
  • Syntax: %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:
          Get the name of the form in the current topic:
          Get the value of the 'Firstname' form field in
            the current topic:
          Get the value of the 'Firstname' form field in
            the current topic (shorthand version):
          Get a list of all the names of attachments on
            the topic 'System.DocumentGraphics':
          Get configuration setting {NameFilter}:
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: {ScriptSuffix}, {LoginManager}, {AuthScripts}, {LoginNameFilterIn}, {AdminUserLogin}, {AdminUserWikiName}, {SuperAdminGroup}, {UsersTopicName}, {AuthRealm}, {MinPasswordLength}, {Register}{AllowLoginName}, {Register}{EnableNewUserRegistration}, {Register}{NeedVerification}, {Register}{RegistrationAgentWikiName}, {AllowInlineScript}, {DenyDotDotInclude}, {UploadFilter}, {NameFilter}, {AccessibleCFG}, {AntiSpam}{EmailPadding}, {AntiSpam}{HideUserDetails}, {AntiSpam}{RobotsAreWelcome}, {Stats}{TopViews}, {Stats}{TopContrib}, {Stats}{TopicName}, {UserInterfaceInternationalisation}, {UseLocale}, {Site}{Locale}, {Site}{CharSet}, {DisplayTimeValues}, {DefaultDateFormat}, {Site}{LocaleRegexes}, {UpperNational}, {LowerNational}, {PluralToSingular}, {EnableHierarchicalWebs}, {WebMasterEmail}, {WebMasterName}, {NotifyTopicName}, {SystemWebName}, {TrashWebName}, {SitePrefsTopicName}, {LocalSitePreferences}, {HomeTopicName}, {WebPrefsTopicName}, {UsersWebName}, {TemplatePath}, {LinkProtocolPattern}, {NumberOfRevisions}, {MaxRevisionsInADiff}, {ReplaceIfEditedAgainWithin}, {LeaseLength}, {LeaseLengthLessForceful}, {Plugins}{WebSearchPath}, {PluginsOrder}, {Cache}{Enabled}, {Validation}{Method}, {Register}{DisablePasswordConfirmation}

Topic revision: r1 - 19 Sep 2010, ProjectContributor
This site is powered by FoswikiCopyright © CC-BY-SA by the contributing authors. All material on this collaboration platform is copyrighted under CC-BY-SA by the contributing authors unless otherwise noted.
Ideas, requests, problems regarding Foswiki? Send feedback