RadarSoft.RadarCube.Web.MSAS Send comments on this topic.
OnDefineIndex Event
See Also  Example
RadarSoft.RadarCube.Web Namespace > TOLAPCube Class : OnDefineIndex Event




The event allows to define searching indexes for a table.

Syntax

Visual Basic (Declaration) 
Public Event OnDefineIndex As TDefineIndexEvent
Visual Basic (Usage)Copy Code
Dim instance As TOLAPCube
Dim handler As TDefineIndexEvent
 
AddHandler instance.OnDefineIndex, handler
C# 
public event TDefineIndexEvent OnDefineIndex
Managed Extensions for C++ 
public: __event TDefineIndexEvent* OnDefineIndex
C++/CLI 
public:
event TDefineIndexEvent^ OnDefineIndex

Example

C#Copy Code
private void OLAPCube_OnDefineIndex(object Sender, TDefineIndexArgs e)
{
    // Here we can index the tables we're gonna search for the records
    if (e.ThisTable("Categories"))
        // The index named "Category" will index the table by the "CategoryName" field
        e.Indexes.AddKeyColumns("Category", "CategoryName");
}

Remarks

The event occurs when a table is about to start reading table's records from the database. This is the time and place to define indexes available for a table. If there is a primary index for a table then it is already defined by the time the event occurs.

The event handler takes a single parameter of the TDefineIndexArgs class, which among other properties has the Indexes collection. This property is a collection of indexes available for the table. If there is a primary index then it already exists in the collection. The main purpose of the event handler is to create additional indexes (a table index is represented by TDataIndex class) and insert them into the Indexes collection.

You can do that by using the methods of TDataIndexCollection class, namely AddKeyColumns, which is the best way to create new indexes and define key columns for them. See the description of the method for details.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2010 Radar-Soft, L.L.C. All Rights Reserved.