IDimMacroSelectionPrimitive.Module

Syntax

Module: IMetabaseObjectDescriptor;

Description

The Module property determines the repository object containing an application macro used for creating a selection schema.

Comments

The property is used together with IDimMacroSelectionPrimitive.ModuleMacro.

Example

Executing the example requires that the repository contains a dictionary with the DICT_SCHEMA identifier containing a selection schema, and a unit with the MACRO_DIM_SELECTION identifier containing the Primitives class that implements the SelectionMacro procedure. This procedure is used as a macro that creates a selection schema. Code of the MACRO_DIM_SELECTION unit is given below.

Add links to the Dimensions, Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    Desc: IMetabaseObjectDescriptor;
    Schema: IDimSelectionSchema;
    i: Integer;
    MacroPrimitive: IDimMacroSelectionPrimitive;
Begin
    
// Get current repository
    mb := Metabaseclass.Active;
    
// Get dictionary
    Desc := mb.ItemById("DICT_SCHEMA").Children.Item(0);
    
// Check if the first child dictionary object is a selection schema
    If Desc.ClassId = 1030 Then
        
// Get schema for editing
        Schema := Desc.Edit As IDimSelectionSchema;
        
// Change name of group of elements
        (Schema As IMetabaseObject).Name := "Schema created by macro";
        
// Remove all selection primitives from schema
        i := Schema.Count;
        
Repeat
            i := i - 
1;
            Schema.Remove(i);
        
Until i = 0;
        
// Add a primitive that is a macro, to the schema
        MacroPrimitive := Schema.Add(SelectionPrimitiveType.Macro) As IDimMacroSelectionPrimitive;
        
// Specify unit
        MacroPrimitive.Module := mb.ItemById("MACRO_DIM_SELECTION");
        
// Specify macro binding
        MacroPrimitive.ModuleMacro := "Primitives.SelectionMacro";
        
// Save changes in selection schema
        (Schema As IMetabaseObject).Save;
    
End If;
End Sub UserProc;

Code of the MACRO_DIM_SELECTION unit.

Add a link to the Dimensions system assembly.

Class Primitives: Object
    
    
// Macro for creating a dictionary element selection
    Public Shared Sub SelectionMacro(Selection, Group: IDimSelection);
    
Begin
        
// Include dictionary elements to selection
        Selection.SelectElement(1False);
        Selection.SelectElement(
3False);
        Selection.SelectElement(
5False);
        Selection.SelectElement(
7False);
    
End Sub SelectionMacro;
    
End Class Primitives;

After executing the example all objects using the DICT_SCHEMA dictionary as a dimension will have the Schema Created by Macro selection schema that is created by the MACRO_DIM_SELECTION macro.

See also:

IDimMacroSelectionPrimitive