CreateLimit (Method)

Applies To:

AggregateLimits collection, Limits collection

Description:

Creates a stand-alone limit object. After creating the limit, complete its properties before adding it to the limits collection.

Syntax:

Expression.CreateLimit(limitItem As String) As Limit

Note:

The argument for CreateLimit method varies for regular, computed item, and aggregate limits. For regular limits the argument is a reference to the table topic and the topic item (e.g. CreateLimit(“Sales_Facts.Amount_Sales”)). For computed item and aggregate limits, the argument is a reference to the item Display Name on the request line (e.g. CreateLimit(“Request.Amount Sales”)).

Expression Required:

An expression that returns a Limits object

Example 1:

This example shows how to create a Results limit. When you create a local (Results) limit, the value for the LimitItem parameter needs to be the name of the column the limit is being applied:

MyLimit = ActiveDocument.Sections["Results"].Limits.CreateLimit("State")
MyLimit.Operator = bqLimitOperatorEqual
MyLimit.CustomValues.Add("CA")
MyLimit.SelectedValues.Add("CA")
ActiveDocument.Sections["Results"].Limits.Add(MyLimit)
ActiveDocument.Sections["Results"].Limits[1].DisplayName = "State" Expression Required:

Example 2:

This example sets the FROM clause and the WHERE clause, processes the query, and then restores the original SQL statement:

//Set the FROM clause, Set the WHERE clause, PROCESS, and then RESET SQLActiveDocument.Sections["Query"].CustomSQLFrom("FROM From.Sales_Fact, From.Periods, From.Products") ActiveDocument.Sections["Query"].CustomSQLWhere("WHERE (Periods.Day_Id=Sales_Fact.Day_Id AND 
Products.Product_Id=Sales_Fact.Product_Id)  AND (Periods.Quarter='Q1')")
ActiveDocument.Sections["Query"].Process()
ActiveDocument.Sections["Query"].ResetCustomSQL();