IPrxControl.Value

Fore Syntax

Value: Variant;

Fore.NET Syntax

Value: Object;

Description

The Value property determines the value set in a control.

Comments

The value determined in the Value property depends on the type of control in use:

DimCombo

On using the DimCombo control, depending on whether there is an binding to control the dimension, different values of the Value property are available:

The attribute is set in the ATTRIBUTEVALUE parameter in the connection string. If the ATTRIBUTEVALUE parameter is missing, an attribute with the Identifier purpose is used. On forming a connection string, value of the ATTRIBUTEVALUE parameter can be determined by means of the ValueAttribute property.

To reset value of the control, set the Value property to Null.

Fore Example

Sub GetControlValue(Control: IPrxControl);
Var
    Arr: Array;
    i: Integer;
    BM: IBindingManager;
    Binding: IBindingValue;
Begin
    //If a control has a value, get and display it in the console
    If Control.Value.VarType <> ForeVariantType.NullValue Then
        Debug.Write("Value(s) of control: ");
        //If it is an array, view values of all array elements
        If Control.Value.VarType = ForeVariantType.Matrix Then
            Arr := Control.Value As Array;
            For i := 0 To Arr.Length - 1 Do
                Debug.Write(Arr[i] + " ");
            End For;
            Debug.WriteLine("");
        //If it is an object, cast it to IDimSelection and get the number of selected
        Elseif Control.Value.VarType = ForeVariantType.Object Then
            Debug.WriteLine("Selection IDimSelection. Selected: " + (Control.Value As IDimSelection).SelectedCount.ToString);
        //If it is not an array, neither an object, display its value
        Else
            Debug.WriteLine(Control.Value);
        End If;
        //Attribute that controls value
        BM := New BindingManager.Create;
        Binding := BM.CreateByValue(Control.Binding);
        Debug.WriteLine("Attribute that controls value: "
            + (Binding As IBindingDimCombo).ValueAttribute);
    End If;
End Sub GetControlValue;

The specified function can be used to get value of the control, which is based on the DimCombo editor. The obtained values are displayed in the development environment console and also the identifier of the dictionary attribute, which values form value of the control.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Report;

Sub GetControlValue(Control: IPrxControl);
Var
    Arr: Array;
    i: Integer;
    BM: IBindingManager = New BindingManagerClass();
    Binding: IBindingValue;
Begin
    //If a control has a value, get and display it in the console
    If Control.Value <> Null Then
        System.Diagnostics.Debug.Write("Value(s) of control: ");
        //If it is an array, view values of all array elements
        If Control.Value Is Array Then
            Arr := Control.Value As Array;
            For i := 0 To Arr.Length - 1 Do
                System.Diagnostics.Debug.Write(Arr[i] + " ");
            End For;
            System.Diagnostics.Debug.WriteLine("");
        //If it is an object, cast it to IDimSelection and get the number of selected
        Elseif Control.Value Is IDimSelection Then
            System.Diagnostics.Debug.WriteLine("Selection IDimSelection. Selected: " + (Control.Value As IDimSelection).SelectedCount.ToString());
        //If it is not an array, neither an object, display its value
        Else
            System.Diagnostics.Debug.WriteLine(Control.Value);
        End If;
        //Attribute that controls value
        Binding := BM.CreateByValue(Control.Binding);
        System.Diagnostics.Debug.WriteLine("Attribute that controls value: "
            + (Binding As IBindingDimCombo).ValueAttribute);
    End If;
End Sub;

See also:

IPrxControl