ICalcBlockIteratorStub.UseInFormulas

Syntax

UseInFormulas: Boolean;

Description

The UseInFormulas property returns whether data source is used in formulas.

Comments

Available values:

Example

Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier. A calculation block based on several data sources is created in the algorithm.

Add links to the Algo, Cubes, Metabase system assemblies. Add links to the assemblies required for working with calculation algorithms.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Algo: ICalcObject;
    CalcAlgo: ICalcAlgorithm;
    Block: ICalcBlock;
    IteratorModel: ICalcBlockIteratorModel;
    IteratorStubDel: ICalcBlockIteratorStub;
Begin
    MB := MetabaseClass.Active;
    // Get calculation algorithm
    MObj := MB.ItemById("ALGORITHM");
    Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
    CalcAlgo := Algo As ICalcAlgorithm;
    // Get calculation block
    Block := CalcAlgo.Items.Item(0As ICalcBlock;
    IteratorModel := Block.EditIteratorModel;
    // Get source
    IteratorStubDel := IteratorModel.Stubs.Item(0);
    // Source name
    Debug.WriteLine("Check if it is used in source formulas: " + IteratorStubDel.Stub.Name);
    // Check if cube is used in calculation formulas
    If IteratorStubDel.UseInFormulas = False Then
        // If it is not used, remove it
        Block.StubsIn.Remove(IteratorStubDel.Stub);
    End If;
    // Save changes in calculation block
    Block.SaveObject;
End Sub UserProc;

After executing the example the system checks if the first data source is used in block calculation formulas. If the data source is not used in formulas, it will be removed from the calculation block.

See also:

ICalcBlockIteratorStub