LocalResults (Collection)

Member of:

DataModel object

Description:

Enables you to use local results in joins, and the Request line for processing results sets.

Tip:

All collections have the “Item(NameOrIndex)” method. This is the default method for all collections that returns collection items at a particular index or by 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")

Example 1:

This example adds a local results topic to a query section:

vDM=ActiveDocument.Sections["Query"].DataModel.Catalog.Results.Item(1)ActiveDocument.Sections["Query"].DataModel.LocalResults.Add(vDM)

or

vDM= ActiveDocument.Sections["Query"].DataModel.Catalog.Results.Item("sales_fact")
ActiveDocument.Sections["Query"].DataModel.LocalResults.Add(vDM)

Example 2:

This example shows how to remove all local results topics and count the local results topics in a query section:

ActiveDocument.Sections["Query"].DataModel.LocalResults.RemoveAll()
ActiveDocument.Sections["Query"].DataModel.LocalResults.Count

Example 3:

This example removes a single local results topic and gets the topic item count of the “Results2” local topic:

ActiveDocument.Sections["Query"].DataModel.LocalResults["Results2"].Remove()
ActiveDocument.Sections["Query"].DataModel.LocalResults["Results2"].
LocalResultsTopicItems.Count

Example 4:

This example shows how to add a join between a topic and a local results topic:

Topic1=ActiveDocument.Sections["Query"].DataModel.LocalResults["Sales Fact"]. LocalResultTopicItems.Item("Store Id")
Topic2=ActiveDocument.Sections["Query"].DataModel.Results["Results2"].TopicItems.Item("Store Id")
ActiveDocument.Sections["Query"].DataModel.LocalJoins.Add(Topic1,Topic2, bqJoinLeft)

Example 5:

This example shows how to remove a single local results topic:

//Remove a single Local Results Topic
ActiveDocument.Sections["Query"].DataModel.LocalResults["Results2"].Remove()

Example 6:

This example shows how to get a topic item count of local results:

//Get the Topic Item count of Local Results
TextBox1.Text=ActiveDocument.Sections["Query"].DataModel.LocalResults["Results2"].LocalResultsTopicItems.Count

Example 7:

This example shows you to get a count of local joins in a query section:

//Count Local Joins
TextBox1.Text=ActiveDocument.Sections["Query"].DataModel.LocalJoins.Count

Example 8:

This example shows how to remove all local joins:

//Remove All Local Joins 
ActiveDocument.Sections["Query"].DataModel.LocalJoins.RemoveAll()

Example 9:

This example shows how to add a join between a topic and a local results topic:

//Add Join between Topic and Local Results Topic
Topic1=ActiveDocument.Sections["Query"].DataModel.LocalResults["Sales Fact"].LocalResultTopicItems.Item("Store Id")
Topic2=ActiveDocument.Sections["Query"].DataModel.Results["Results2"].TopicItems.Item("Store Id")
ActiveDocument.Sections["Query"].DataModel.LocalJoins.Add(Topic1, Topic2,bqJoinLeft)

Example 10:

This example shows how to add a topic from local results to the Request Line:

//Add Topic from Local Results to Request Line
ActiveDocument.Sections["Query"].Requests.Add("Results2","Quarter")

Methods:

Add(LocalResultObject As DMResult), Item(NameOrIndex) As LocalResult, RemoveAll()

Properties:

Read-only: Count as Number