ISearchSourceDataResult.CreateDimSelectionSet

Fore Syntax

CreateDimSelectionSet: IDimSelectionSet;

Fore.NET Syntax

CreateDimSelectionSet: Prognoz.Platform.Interop.BISearch.IDimSelectionSet;

Description

The CreateDimSelectionSet method creates a selection, which forms a data slice by found dimension selection elements.

Fore Example

Executing the example requires a form with a button named Button1, the UiErAnalyzer component named UiErAnalyzer1 and any visual components, for which UiErAnalyzer1 is set as data source. Add links to the BISearch, Cubes, Dimensions, Express, Fore, Metabase system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Schema: ISolrSearchEngineSchema;
    SearchExecutor: ISearchExecutor;
    SearchContext: ISolrSourceDataSearchContext;
    Results: ISolrSearchResults;
    Result: ISearchSourceDataResult;
    Source: ISourceMetadata;
    CrInfo: IMetabaseObjectCreateInfo;
    Cube: ICubeInstance;
    Expr: IEaxAnalyzer;
    SelSet: IDimSelectionSet;
Begin
    MB := MetabaseClass.Active;
    //Search and indexing parameters specified for repository
    SharedParams := MB.SpecialObject(MetabaseSpecialObject.SharedParams).Bind As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Schema := SearchEngine.SearchEngineSchema As ISolrSearchEngineSchema;
    //Search parameters
    SearchExecutor := Schema.SearchExecutor(SearchEngineTargetType.SourceData);
    SearchContext := SearchExecutor.CreateContext As ISolrSourceDataSearchContext;
    SearchContext.Locale := LocaleCodeID.Russian;
    SearchContext.Text := "Russia";
    //Search
    Results := SearchExecutor.Search(SearchContext) As ISolrSearchResults;
    //View source information for the first search result
    Result := Results.Item(0As ISearchSourceDataResult;
    Source := Result.SourceMetadata;
    Debug.WriteLine("Slice name: " + Result.Name);
    Debug.WriteLine("Source: " + Source.SourceName + '(' + Source.SourceId + ')');
    //Display slice
    If Source.SourceClassId = MetabaseObjectClass.KE_CLASS_STDCUBE Then
        CrInfo := MB.CreateCreateInfo;
        CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
        Expr := MB.CreateObject(CrInfo).Edit As IEaxAnalyzer;
        Cube := MB.Item(Source.SourceKey).Open(NullAs ICubeInstance;
        Expr.OpenCubeDestination(Cube, Source.DestinationKey, EaxOpenCubeOptions.None);
        //Get slice selection
        SelSet := Result.CreateDimSelectionSet;
        //Set selection in express report
        SelSet.CopyTo(Expr.Pivot.Selection, TrueTrue);
        //Connect to the UiErAnalyzer component
        UiErAnalyzer1.ErAnalyzer := Expr;
        UiErAnalyzer1.Active := True;
    End If;
End Sub Button1OnClick;

On clicking the button the specified values will be searched by indexed information about dimension elements. The information about data source will be received from the first found result. If the standard cube is the source, the following actions will be executed:

After this the express report will be connected to the form components to view data of the found slice.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components. Along with the assemblies determined in the Fore example, also add a link to the System assembly.

Imports Prognoz.Platform.Interop.BISearch;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.KeFore;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Pivot;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Schema: ISolrSearchEngineSchema;
    SearchExecutor: ISearchExecutor;
    SearchContext: ISolrSourceDataSearchContext;
    Results: ISolrSearchResults;
    Result: ISearchSourceDataResult;
    Source: ISourceMetadata;
    CrInfo: IMetabaseObjectCreateInfo;
    Cube: ICubeInstance;
    Expr: EaxAnalyzer;
    SelSet: IDimSelectionSet;
Begin
    MB := Self.Metabase;
    //Search and indexing parameters specified for repository
    SharedParams := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Bind() As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Schema := SearchEngine.SearchEngineSchema As ISolrSearchEngineSchema;
    //Search parameters
    SearchExecutor := Schema.SearchExecutor[SearchEngineTargetType.settSourceData];
    SearchContext := SearchExecutor.CreateContext() As ISolrSourceDataSearchContext;
    SearchContext.Locale := LocaleCodeID.lcidRussian;
    SearchContext.Text := "Russia";
    //Search
    Results := SearchExecutor.Search(SearchContext) As ISolrSearchResults;
    //View source information for the first search result
    Result := Results.Item[0As ISearchSourceDataResult;
    Source := Result.SourceMetadata;
    System.Diagnostics.Debug.WriteLine("Slice name: " + Result.Name);
    System.Diagnostics.Debug.WriteLine("Source: " + Source.SourceName + '(' + Source.SourceId + ')');
    //Display slice
    If Source.SourceClassId = (MetabaseObjectClass.KE_CLASS_STDCUBE As uinteger) Then
        CrInfo := MB.CreateCreateInfo();
        CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT As integer;
        Expr := MB.CreateObject(CrInfo).Edit() As EaxAnalyzer;
        Cube := MB.Item[Source.SourceKey].Open(NullAs ICubeInstance;
        Expr.OpenCubeDestination(Cube, Source.DestinationKey, EaxOpenCubeOptions.eocoNone);
        //Get slice selection
        SelSet := Result.CreateDimSelectionSet();
        //Set selection in express report
        SelSet.CopyTo(Expr.Pivot.Selection, TrueTrue);
        //Connect to the UiErAnalyzerNet component
        UiErAnalyzerNet1.AnalyzerUi.ErAnalyzer := Expr;
        UiErAnalyzerNet1.Active := True;
    End If;
End Sub;

See also:

ISearchSourceDataResult