IPrxAlgorithmConstantParamControl.ConstantValue

Syntax

ConstantValue: Variant;

Description

The ConstantValue property determines a constant value sent to calculation algorithm parameter.

Comments

As a value, specify key or array of elements of the dictionary that is used to work with calculation algorithm parameter. If an array of keys is sent, the array should have the Variant type.

Example

Executing the example requires that the repository contains a regular report with the REPORT identifier and a calculation algorithm with the ALGORITHM identifier. The algorithm and the regular report contain a parameter based on the same repository dictionary.

The file system should contain the button image file D:\Work\Image\btn16x16.png.

Add links to the IO, Metabase, and Report system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    Report: IPrxReport;
    UserBtn: IPrxUserButton;
    AlgAction: IPrxUserButtonActionAlgorithm;
    AlgParam: IPrxAlgorithmParam;
    ElementKeys: Array;
Begin
    Mb := MetabaseClass.Active;
    Report := Mb.ItemById("REPORT").Edit As IPrxReport;
    // Create a new custom button
    UserBtn := Report.UserButtons.AddByType(PrxUserButtonType.Algorithm);
    UserBtn.Name := "Start algorithm";
    // Set up custom button
    UserBtn.Icon := New FileStream.Create("d:\Work\Images\btn16x16.png", FileOpenMode.Read, FileShare.DenyNone);
    UserBtn.IconType := "png";
    UserBtn.SmallIcon := False;
    // Set up actions
    AlgAction := UserBtn.Action As IPrxUserButtonActionAlgorithm;
    AlgAction.Algorithm := Mb.ItemById("ALGORITHM");
    AlgParam := AlgAction.Params.Item(0);
    AlgParam.Type := PrxAlgorithmParamType.Constant;
    ElementKeys := New Variant[2];
    ElementKeys[0] := 1;
    ElementKeys[1] := 2;
    (AlgParam.Control As IPrxAlgorithmConstantParamControl).ConstantValue := ElementKeys;
    // Save changes
    (Report As IMetabaseObject).Save;
End Sub UserProc;

After executing the example a new custom button is created in the regular report. Name and image are set for the button. Algorithm calculation is selected as a custom button action. A constant value that is a selection of two elements with the specified keys will be sent to calculation algorithm parameter.

See also:

IPrxAlgorithmConstantParamControl