IMsMethod.UseR

Fore Syntax

UseR: Boolean;

Fore.NET Syntax

UseR: boolean;

Description

The UseR property determines whether connection to R is used on method calculation.

Comments

To get information whether method can be calculated by R, use the IMsMethod.SupportsR property.

Available values of UseR:

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier containing a model with the MODEL_R identifier. Integration with R must be set up in the repository. For details about integration setup see the How to Set Up Integration with R? section.

Add links to the Metabase, Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    msKey: Integer;
    modelObj: IMetabaseObject;
    transf: IMsFormulaTransform;
    formula: IMsFormula;
    method: IMsMethod;
Begin
    // Get repository
    mb := MetabaseClass.Active;
    // Get modelling container key
    msKey := mb.GetObjectKeyById("MS");
    // Get model
    modelObj := mb.ItemByIdNamespace("MODEL_R", msKey).Edit;
    // Get model calculation parameters
    transf := (modelObj As IMsModel).Transform;
    formula := transf.FormulaItem(0);
    method := formula.Method;
    // Check if model can be calculated by R package
    If method.SupportsR
        Then
            method.UseR := True;
            Debug.WriteLine("Model is calculated by means of connection to R");
        Else
            Debug.WriteLine("Model does not support calculation by R");
    End If;
    // Save changes
    modelObj.Save;
End Sub UserProc;

After executing the example the model is calculated by R. If the model does not support calculation by R, the console window displays corresponding message.

Fore.NET Example

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

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    msKey: uinteger;
    modelObj: IMetabaseObject;
    transf: IMsFormulaTransform;
    formula: IMsFormula;
    method: IMsMethod;
Begin
    // Get repository
    mb := Params.Metabase;
    // Get modelling container key
    msKey := mb.GetObjectKeyById("MS");
    // Get model
    modelObj := mb.ItemByIdNamespace["MODEL_R", msKey].Edit();
    // Get model calculation parameters
    transf := (modelObj As IMsModel).Transform;
    formula := transf.FormulaItem[0];
    method := formula.Method;
    // Check if model can be calculated by R package
    If method.SupportsR
        Then
            method.UseR := True;
            System.Diagnostics.Debug.WriteLine("Model is calculated by means of connection to R");
        Else
            System.Diagnostics.Debug.WriteLine("Model does not support calculation by R");
    End If;
    // Save changes
    modelObj.Save();
End Sub;

See also:

IMsMethod