AppendQueries (Collection)

Member of:

QuerySection object

Description:

Represents a collection of query objects used in an appended query.

Tip:

All collections have a method named “Item(NameOrIndex).” This is the default method for all collections and returns an item in the collection 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")

Syntax:

To expose the AppendQueries (Collection), use this syntax:

ActiveDocument.Sections["Query"].AppendQueries 

The AppendQueries (Collection) includes these methods and properties:

ActiveDocument.Sections["Query"].AppendQueries.Add()
ActiveDocument.Sections["Query"].AppendQueries.Item()
ActiveDocument.Sections["Query"].AppendQueries.Count

The Requests (Collection) includes these methods and properties:

ActiveDocument.Sections["Query"].AppendQueries.Requests.Add(String, String)
ActiveDocument.Sections["Query"].AppendQueries.Requests.AddComputedItem(String, String, BQDataType)
ActiveDocument.Sections["Query"].AppendQueries.Requests.Item(Value)
ActiveDocument.Sections["Query"].AppendQueries.Requests.RemoveAll()
ActiveDocument.Sections["Query"].AppendQueries.Requests.Count 

An item of the Requests (Collection) includes these methods and properties:

ActiveDocument.Sections["Query"].AppendQueries.Requests[1].Remove()
ActiveDocument.Sections["Query"].AppendQueries.Requests[1].DataType
ActiveDocument.Sections["Query"].AppendQueries.Requests[1].DisplayName 
ActiveDocument.Sections["Query"].AppendQueries.Requests[1].SQLName
ActiveDocument.Sections["Query"].AppendQueries.Requests[1].Visible 

The Limits (Collection) under the AppendQuery item includes these methods and properties:

ActiveDocument.Sections["Query"].AppendQueries.Limits.Add(Limit)
ActiveDocument.Sections["Query"].AppendQueries.Limits.CreateLimit(String)
ActiveDocument.Sections["Query"].AppendQueries.Limits.Item(Value)
ActiveDocument.Sections["Query"].AppendQueries.Limits.RemoveAll()
ActiveDocument.Sections["Query"].AppendQueries.Limits.Count 

Example 1:

This example illustrates how to append queries using the Union operator:

ActiveDocument.Sections["Query"].AppendQueries.Add()
ActiveDocument.Sections ["Query"].AppendQueries[1].UnionController=bqUnion

Example 2:

This example illustrates how to add Periods and Quarters to the Request line, and remove the second request line item:

ActiveDocument.Sections["Query"].AppendQueries.Requests.Add("Periods","Quarters")
ActiveDocument.Sections["Query"].AppendQueries.Requests[2].Remove()

Example 3:

This example illustrates how to place filters on the Periods request line item and add Quarter 1 to the filter value:

MyLimit=ActiveDocument.Sections["Query"].AppendQueries.Limits.CreateLimit ("Periods")
ActiveDocument.Sections["Query"].AppendQueries.Limits[1].SelectedValues.Add("Q1")ActiveDocument.Sections["Query"].AppendQueries.Limits.Add(MyLimit)

Example 4:

This example illustrates how to count items in the AppendQueries (Collection):

QueryCount = ActiveDocument.Sections["Query"].AppendQueries.Count

Example 5:

This example illustrates how to name the appended query MyQuery:

ActiveDocument.Sections["Query"].AppendQueries[1].Name="MyQuery"

Example 6:

This example illustrates how to add "Periods" and "Quarters", and "Periods and "Year" to the Request line. The third line removes the second request line items.

ActiveDocument.Sections["Query"].AppendQueries.Requests.Add("Periods","Quarter")
ActiveDocument.Sections["Query"].AppendQueries.Requests.Add("Periods","Year")
ActiveDocument.Sections["Query"].AppendQueries.Requests[2].Remove()

Example 7:

This example illustrates how to return the data type, display name, SQL name, and make the base object visible.

RequestDT=ActiveDocument.Sections["Query"].AppendQueries.
Requests[1].DataTypeRequestDN=ActiveDocument.Sections["Query"].AppendQueries.
Requests[1].DisplayNameRequestSQLName=ActiveDocument.Sections["Query"].AppendQueries.
Requests[1].SQLNameRequestVisible=ActiveDocument.Sections["Query"].AppendQueries.Requests[1].Visible

Example 8:

This example illustrates how to perform these tasks:

MyLimit=ActiveDocument.Sections["Query"].AppendQueries.Limits.CreateLimit("Periods.Quarter")
ActiveDocument.Sections["Query"].AppendQueries.Limits[1].Operator= bqLimitOperatorEqualActiveDocument.Sections["Query"].AppendQueries.Limits[1].SelectedValues.Add("Q1")
ActiveDocument.Sections["Query"].AppendQueries.Limits.Add(MyLimit)
ActiveDocument.Sections["Query"].AppendQueries.Limits.Count

Example 9:

This example illustrates how to remove all items from the request line and return a count of items from the Request (Collection). The last line shows how to remove item number 1 from the request line.

ActiveDocument.Sections["Query"].AppendQueries.Requests.RemoveAll()
ActiveDocument.Sections["Query"].AppendQueries.Requests.Count
ActiveDocument.Sections["Query"].AppendQueries[1].Remove()

Methods:

Add (), Item(Value NameOrIndex) As AppendQueries

Properties:

Count As Number

Collections:

Parentheses as UnionPairs