CreateDimSelectionSet: IDimSelectionSet;
The CreateDimSelectionSet method creates a selection, which forms a data slice by found dimension selection elements.
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(0) As 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(Null) As ICubeInstance;
Expr.OpenCubeDestination(Cube, Source.DestinationKey, EaxOpenCubeOptions.None);
//Get slice selection
SelSet := Result.CreateDimSelectionSet;
//Set selection in express report
SelSet.CopyTo(Expr.Pivot.Selection, True, True);
//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:
The express report is created dynamically.
The obtained cube is set as source for express report.
The selection corresponding to the found slice will be created. The selection is set in express report.
After this the express report will be connected to the form components to view data of the found slice.
See also: