VarQUERY can be used as an alternative to
VarSEARCH or
VarFORMAT's
$formfield()
FormatTokens (Eg. by replacing
$formfield(MyField)
with
$percntQUERY{'$web.$topic'/MyField}$percnt
)
VarQUERY can also often be used in place of
VarFORMFIELD and
VarMETA.
VarQUERY has a
style
parameter which understands a few different serialisation formats, one of them is
json
which automatically takes care of escaping any quotes (") in the content. Compare:
%FORMFIELD{"TopicTitle"}%
Test:
How do I escape double-quotes (") in my formfield data? For Eg. nested macro expressions
vs
%QUERY{"TopicTitle" style="json"}%
Test:
"How do I escape double-quotes (\") in my formfield data? For Eg. nested macro expressions"
You can make
VarQUERY extract data from a topic other than the topic in which it's written by using the
/
reference operator (see
QuerySearch syntax), Eg.:
%QUERY{"'Support.Faq40'/TopicTitle" style="json"}%
Test:
"How do I re-write =DBQUERY= as =SEARCH{type=\"query\"}=?"
style="json"
results in a valid JSON fragment, i.e. it returns a string quoted in double-quotes. Be mindful of this when replacing Eg. VarFORMFIELD macros