2022.2

Table Of Contents
results
Theresultsobject(type:QueryResults)istheresultofthequeryforHTMLelementsthatmatch
theselectorofthescript.TheselectorofascriptcanbespecifiedintheScriptEditorandisvisiblein
thesecondcolumnoftheScriptspane,nexttothenameofthescript.
If,forexample,ascriptwouldhavetheselectorp.onlyCanada,thescriptwouldapplytoallpara-
graphsthathavetheclassonlyCanada.(ClassescanbedefinedintheAttributespaneattheright:
selecttheelementinthecontentandtypetheclass(es)intheClassfield.)
Thescriptcouldthenusetheresultsobjecttohideorshowthoseparagraphs,dependingonthe
valueofthedatafieldCountryinthecurrentrecord:
if (record.fields["Country"] == "CANADA") {
results.show();
} else {
results.hide();
}
Note: Thisobjectcan'tbeusedinControlScripts,becausetheydon'thaveaselector.
Tip: Theeasiestwaytoaccesstheelementsinaresultsetonebyone,isbysettingthescopeof
thescriptto"Eachmatchedelement"andusingthethisobject(see"this"onpage1237).
Property
Field Type Description
length Number Number of elements in this result set. Equivalent to calling size().
Functions
Thefunctionsbelowcanbecalledbytheresultsobjectandbyanyotherresultsetthatisreturnedby
aquery,see"query()"onpage1197.
Function Description
"add()"onpage1239 AddselementstoasetofHTMLelements.
"addClass()"on
page1241
AddsthespecifiedclasstoeachelementinasetofHTMLelements.Hasnoeffectiftheclassisalreadypresent.
"after()"on
page1242
InsertscontentaftereachelementinasetofHTMLelements..
Page 1202