Sort Items, XCategory object, ZCategory object
Returns or sets the ascending or descending sort order property. The SortNow (Method) is required to use the SortOrder (Property).
The constant associated with this property is a member of the constant group called BqSortOrder, which consists of the bqSortAscend and bqSortDescend constants.
This example shows how to use the SortOrder (Property) in a Table section. The example references the Add (Method), Sorting (Method), SortOrder (Property) and BqSortOrder constant groups. It involves four command buttons and two text boxes that record the actions of the scripts as they execute.
//adds the Store Id conditon
ActiveSection.Shapes["CommandButton1"].OnClick()
TextBox1.Text = "Start Add Sort"
try
{
ActiveDocument.Sections["Table"].SortItems.Add("Store Id")
}
catch(e)
{
TextBox2.Text = e.toString()
}
TextBox1.Text = "End Add Sort"//invokes the SortNow method
ActiveSection.Shapes["CommandButton1"].OnClick()
TextBox1.Text = "Start SortNow"
try
{
ActiveDocument.Sections["Table"].SortItems.SortNow()}
catch(e)
{
TextBox2.Text = e.toString()
}
TextBox1.Text ="End SortNow"//invokes the SortOrder property and bqSortAscend constant
ActiveSection.Shapes["CommandButton1"].OnClick()
TextBox1.Text = "Start SortOrder"
try
{
TextBox1.Text = "Step1"
ActiveDocument.Sections["Table"].SortItems[1].SortOrder = bqSortAscend
TextBox1.Text = "Step2"
TextBox3.Text = ActiveDocument.Sections["Table"].SortItems[1].SortOrder
TextBox1.Text = "Step3"
switch(ActiveDocument.Sections["Table"].SortItems[1].SortOrder)
{
case 1:
TextBox3.Text = "Sort Order is bqSortAscend"
break;
case 2:
TextBox3.Text = "Sort Order is bqSortDescend"
break;
default:
TextBox3.Text = "No Sort Order is Available"
}
}
catch(e)
{
TextBox2.Text = e.toString()
}
TextBox1.Text = "End SortOrder"//invokes the SortOrder property and bqSortAscend constant
TextBox1.Text = "Start SortOrder"
try
{
TextBox1.Text = "Step1"
ActiveDocument.Sections["Table"].SortItems[1].SortOrder = bqSortDescend
TextBox1.Text = "Step2"
TextBox3.Text = ActiveDocument.Sections["Table"].SortItems[1].SortOrder
TextBox1.Text = "Step3"
switch(ActiveDocument.Sections["Table"].SortItems[1].SortOrder)
{
case 1:
TextBox3.Text = "Sort Order is bqSortAscend"
break;
case 2:
TextBox3.Text = "Sort Order is bqSortDescend"
break;
default:
TextBox3.Text = "No Sort Order is Available"
}
}
catch(e)
{
TextBox2.Text = e.toString()
}
TextBox1.Text = "End SortOrder"