Represents items that enable you to limit a Request item that was computed using a data function in the Query section.
Setting an aggregate limit on Request items displays a divider on the Limit line. The limit icon displays to the right of the divider, indicating that the limit applied the SQL Having clause.
The AggregateLimits (Collection) is identical to the Limits (Collection) except it is used only for aggregate limits and the AvailableValues (Collection) is unavailable for use. For more information on regular limits and computed item limits, see the Limits (Collection).
In terms of structure and content, the AggregateLimits (Collection) is identical to the Limits (Collection). One difference is that the AggregateLimits (Collection) is used only for aggregate limits and not regular or computed item limits. Another difference is that the AvailableValues (Property) (also know as the ShowValue button in the user interface) is unavailable for computed or aggregate items.The syntax for aggregate limit items is Request.DisplayName (without reference to the Data Function). Refer to limit objects by number or name.
Computed item limits and regular item limits share the identical syntax and collections. The one exception is the argument used with the CreateLimit(limit_item) method. The limit_item argument type is a string for both regular limit items and computed items, and it refers to the limit item on the limit line. The regular limit item reference is a Topic.TopicItem.
For example, in a Products table and a Product_Line column, the reference is as follows:
CreateLimit("Products.Product_Line")
The syntax for the computed item limits is as follows:
Request.DisplayName.
For example, in a DoubleSales computed item on the Request line, the reference is:CreateLimit(“Request.DoubleSales”). References other limit objects by number or name.
All collections have the “Item(NameOrIndex)” method. This is the default method for all collections that returns item in collections at a particular index or with a specific name. Use brackets ([]) to represent calls to the Item (Method). For example, these statements are identical:myItem = Documents[1] myItem = Documents.Item(1) myItem = Documents["StartUp.bqy"] myItem = Documents.Item("StartUp.bqy") |
This example illustrates how to create aggregate limits, add values to the limits, display the limit names, and add limits to the limit line:
// Aggregate Limit var MyLimit = ActiveDocument.Sections["Query"].AggregateLimits.CreateLimit ("Request.Dealer Price"); MyLimit.Operator =bqLimitOperatorLessThan; MyLimit.CustomValues.Add("150"); MyLimit.SelectedValues.Add("150"); MyLimit.DisplayName = "Price"; ActiveDocument.Sections["Query"].AggregateLimits.Add(MyLimit);
This example illustrates how to create computed item limits, add values to the limits, display the limit names, and add limits to limit lines:
//Computed Item Limitvar MyLimit = ActiveDocument.Sections["Query"].Limits.CreateLimit("Request.TotalSales");MyLimit.Operator=bqLimitOperatorGreaterThan;MyLimit.CustomValues.Add("5000");MyLimit.SelectedValues.Add("5000");//MyLimit.DisplayName = "Price";ActiveDocument.Sections["Query"].Limits.Add(MyLimit);
This example illustrates how to create a “Dealer Price” limit, add values to the limit, and add the regular item limit to the limit line:
//Regular Limitvar MyLimit = ActiveDocument.Sections["Query"].Limits.CreateLimit("PCW_ITEMS.Dealer_Price");MyLimit.Operator =bqLimitOperatorGreaterThan;MyLimit.CustomValues.Add("130");MyLimit.SelectedValues.Add("130");//MyLimit.DisplayName = "Price";ActiveDocument.Sections["Query"].Limits.Add(MyLimit)
Add(Limit As Limit), CreateLimit(limitItem As String) As Limit, Item(Value as NameOrIndex) As Limit, RemoveAll()