IPivotFilterAttributeLinks.Add

Syntax

Add: IPivotFilterAttributeLink;

Description

The Add method adds a new attribute link to the collection and returns its parameters.

Example

Executing the example requires that the repository contains an express report with the EXPRESS_REPORT identifier. The express report contains at least two dimensions by rows. The structure of the first dimension must contain an attribute with the ID identifier, the structure of the second dimension must contain an attribute with the P_ID identifier. Add links to the Dimension, Express, Metabase, Pivot system assemblies.

Sub CreateAttributeLink;
Var
    MB: IMetabase;
    Report: IEaxAnalyzer;
    Pivot: IPivot;
    LeftHeader: IPivotHeader;
    Filter: IPivotFilterSettings;
    AttrLinkFilter: IPivotFilterAttributeLink;
Begin
    MB := MetabaseClass.Active;
    Report := MB.ItemById("EXPRESS_REPORT").Edit As IEaxAnalyzer;
    Pivot := Report.Pivot;
    //Dimensions located by rows
    LeftHeader := Pivot.LeftHeader;
    //Filtering parameters in table
    Filter := Pivot.Filter As IPivotFilterSettings;
    //Create new attribute link
    AttrLinkFilter := Filter.AttributeLinks.Add;
    //Set up link parameters
    AttrLinkFilter.FirstDimensionKey := LeftHeader.Dim(0).Key;
    AttrLinkFilter.FirstDimensionAttrId := "ID";
    AttrLinkFilter.FirstDimensionAllowNull := True;
    AttrLinkFilter.SecondDimensionKey := LeftHeader.Dim(1).Key;
    AttrLinkFilter.SecondDimensionAttrId := "P_ID";
    AttrLinkFilter.SecondDimensionAllowNull := True;
    //If the link works, save express report
    If AttrLinkFilter.IsValid Then
        (Report As IMetabaseObject).Save;
    End If;
End Sub CreateAttributeLink;

On executing the example dimension attributes filter is added for express report data. The link is established between the first and the second dimensions, which are located by rows.

See also:

IPivotFilterAttributeLinks