Traversing the Object Model Tree

Starting from the root of the object model tree, traverse relevant branches and nodes.

Apply values to relevant properties.

The best place to apply the property-value code is the OnStartUp script.

Example of traversing a query section branch of the object model tree and applying Store as the query limit:

//gets the store id value from the SmartCut
var A_Limit=Session.URL.Item('store_id');


//identifies query section to work with
var QuerySect=ActiveDocument.Sections["Query"];


//checks all limits till the appropriate one is found and applies limit
for (i=1; i<=QuerySect.Limits.Count; i++)
{
    if  (QuerySect.Limits[i].Name=="Store")
     QuerySect.Limits[i].SelectedValues.Add(A_Limit)
}
ActiveDocument.Sections["Query"].Process()