The script below is to create a limit and then add the desired limit value(s) on a local results set via a user selection of list box value(s).
The list box values can be populated statically or dynamically. For dynamic population, see related post.
This script can be added to the list box itself or to a button. Be sure to select ‘Allow Multiple Selections’ in the list box property if required.
Reqs: Listbox (lstbx_1), Results section (“Results”), the new local limit you are going to create (“My Local Limit Column” below).
//remove existing limits
ActiveDocument.Sections["Results"].Limits.RemoveAll()
//count and add the selections to the new local limit
var count_selects=lstbx_1.SelectedList.Count;
if (count_selects>0)
{
ActiveDocument.Sections["Results"].Limits.RemoveAll()
var my_limit;
var add_limit;
my_limit=ActiveDocument.Sections["Results"].Columns["My Local Limit Column"].Name;
add_limit=ActiveDocument.Sections["Results"].Limits.CreateLimit(my_limit);
for (i=1; i<=count_selects; i++)
{
add_limit.SelectedValues.Add(lstbx_1.SelectedList.Item(i));
}
add_limit.Operator=bqLimitOperatorEqual;
ActiveDocument.Sections["Results"].Limits.Add(add_limit)
ActiveDocument.Sections["Results"].Recalculate()
}
Baeball Cards
7 years ago
No comments:
Post a Comment