IMsProblemCalculationSettings.EntriesFilter

Fore Syntax

EntriesFilter: IMsCalculationChainFilter;

Fore.NET Syntax

EntriesFilter: Prognoz.Platform.Interop.Ms.IMsCalculationChainFilter;

Description

The EntriesFilter property returns the collection of elements calculated by problem.

Comments

This property enables the user to calculate only part of calculation chain without saving metamodel.

If the following element is added to the collection:

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier containing a modeling problem with the PROBLEM_FILTER identifier. Metamodel calculated by this problem must contain several elements in calculation chain.

Add links to the Metabase, Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    MsKey: Integer;
    Problem: IMsProblem;
    CalcChain: IMsCalculationChainEntries;
    CalcSettings: IMsProblemCalculationSettings;
    ChainFilter: IMsCalculationChainFilter;
    Calculation: IMsProblemCalculation;
    i: Integer;
Begin
    mb := MetabaseClass.Active;
    // Get modelling container key
    MsKey := mb.GetObjectKeyById("MS");
    // Get modeling problem
    Problem := mb.ItemByIdNamespace("PROBLEM_FILTER", MsKey).Edit As IMsProblem;
    // Get problem calculation parameters
    CalcSettings := Problem.CreateCalculationSettings;
    // Get collection of calculated elements
    ChainFilter := CalcSettings.EntriesFilter;
    // Clear collection
    ChainFilter.Clear;
    // Get calculation chain
    CalcChain := Problem.EditMetaModel.CalculationChain;
    // Add only odd elements from calculation chain to collection of calculated elements
    For i := 1 To CalcChain.Count Do
        If (i Mod 2) <> 0 Then
            ChainFilter.Add(CalcChain.Item(i - 1));
        End If;
    End For;
    // Output names of calculated elements to console window
    Debug.WriteLine("Names of calculated elements:");
    For i := 0 To ChainFilter.Count - 1 Do
        Debug.WriteLine(ChainFilter.Item(i).Name);
    End For;
    // Calculate problem
    Calculation := Problem.Calculate(CalcSettings);
    Calculation.Run;
End Sub UserProc;

After executing the example only odd elements from calculation chain are used in problem calculation.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.

Imports Prognoz.Platform.Interop.Ms;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    MsKey: uinteger;
    Problem: IMsProblem;
    CalcChain: IMsCalculationChainEntries;
    CalcSettings: IMsProblemCalculationSettings;
    ChainFilter: IMsCalculationChainFilter;
    Calculation: IMsProblemCalculation;
    i: Integer;
Begin
    mb := Params.Metabase;
    // Get modelling container key
    MsKey := mb.GetObjectKeyById("MS");
    // Get modeling problem
    Problem := mb.ItemByIdNamespace["PROBLEM_FILTER", MsKey].Edit() As IMsProblem;
    // Get problem calculation parameters
    CalcSettings := Problem.CreateCalculationSettings();
    // Get collection of calculated elements
    ChainFilter := CalcSettings.EntriesFilter;
    // Clear collection
    ChainFilter.Clear();
    // Get calculation chain
    CalcChain := Problem.EditMetaModel.CalculationChain;
    // Add only odd elements from calculation chain to collection of calculated elements
    For i := 1 To CalcChain.Count Do
        If (i Mod 2) <> 0 Then
            ChainFilter.Add(CalcChain.Item[i - 1]);
        End If;
    End For;
    // Output names of calculated elements to console window
    System.Diagnostics.Debug.WriteLine("Names of calculated names:");
    For i := 0 To ChainFilter.Count - 1 Do
        System.Diagnostics.Debug.WriteLine(ChainFilter.Item[i].Name);
    End For;
    // Calculate problem
    Calculation := Problem.Calculate(CalcSettings);
    Calculation.Run();
End Sub;

See also:

IMsProblemCalculationSettings