IDimBuilder.SetAttributeInstanceValuesLoader

Syntax

SetAttributeInstanceValuesLoader(Loader: IDimAttributeInstanceValuesLoader);

Parameters

Loader. Loader of additional attributes values.

Description

The SetAttributeInstanceValuesLoader method sets value loader of additional attributes.

Comment

This method is used to work with all types of Platform's dictionaries.

Example

Executing the example requires that repository contains calculated dictionary with three attributes.

This example is a macro for calculated dictionary. The LoadDim procedure can be used to set up delayed loading for attribute.

Sub LoadDim(UserDim: IUserDimension; Builder: IDimBuilder);
Var
    loader: IDimBlockLoader;
    row: Integer;
Begin
    // Set delayed loading for attribute
    Builder.SetAttributeInstanceValuesLoader(New AttributeValuesLoader.Create(UserDim.Attributes.Item(2).Key, UserDim.Blocks.Item(0).Key));
    
//Create loader of root elements
    loader := Builder.CreateRootBlockLoader(UserDim.Blocks.Item(0).Key);
    
//Create root elements
    row := loader.AddRow;
    loader.Value(row, 
0) := 1;
    loader.Value(row, 
1) := "1";
End Sub LoadDim;
// Delayed loader
Class AttributeValuesLoader: Object, IDimAttributeInstanceValuesLoader
    attributeKey: Integer;
    blockKey: Integer;
    
Public Constructor Create(attributeKey: Integer; blockKey: Integer);
    
Begin
        Self.attributeKey := attributeKey;
        Self.blockKey := blockKey;
    
End Constructor Create;
    
// Determine the Load method
    Sub Load(Arguments: IDimAttributeInstanceValuesLoaderArguments);
    
Var
        loader: IDimBlockLoader;
        row: Integer;
    
Begin
        
If (Arguments.AttributeKeys <> NullAnd (Arguments.AttributeKeys.Length > 0And (Arguments.AttributeKeys[0] = Self.attributeKey) Then
            loader := Arguments.BlockLoader(Self.blockKey);
            row := loader.AddRow;
            
// Loading attribute of primary key to link this row to loaded element
            loader.Value(row, 0) := 1;
            
// Fill in attribute with delayed loading
            loader.Value(row, 2) := "defered value";
        
End If;
    
End Sub Load;   
End Class AttributeValuesLoader;

After executing the procedure, loading of attribute values will be delayed.

See also:

IDimBuilder