IMsModelParam.ObjectParam

Syntax

ObjectParam: IMetabaseObjectParam;

Description

The ObjectParam property determines the parameter, with which the current metamodel parameter is connected.

Comments

As a property value, the object parameter is specified that is described by the IMetabaseObjectParam interface. The parameter should be created in metamodel metadata in the IMetabaseObjectDescriptor.Params collection. It is available to set up parameters management between metamodel parameters and problem parameters via the standard mechanism IMetabaseObjectParams.ControlInfo.

The example of opening problem with parameters is given in the Opening Problem with Parameters subsection.

Example

Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. A problem with the PROBLEM identifier and a metamodel with the METAMODEL identifier is created in the container.

Add links to the system assemblies:

Sub UserProc;
Var
    Mb: IMetabase;
    ProblemDesc, MetaModelDesc: IMetabaseObjectDescriptor;
    pParam, mParam: IMetabaseObjectParam;
    MetaModel: IMsMetaModel;
    Control: IMetabaseObjectControl;
    ParamControl: IMetabaseObjectParamControl;
    ModelParam: IMsModelParam;
Begin
    Mb := MetabaseClass.Active;
    
// Create a metamodel parameter
    MetaModelDesc := Mb.ItemByIdNamespace("METAMODEL", Mb.GetObjectKeyById("CONT_MODEL")).EditDescriptor;
    MetaModelDesc.Params.Clear;
    mParam := MetaModelDesc.Params.Add;
    mParam.Id := 
"ADDITIONAL";
    mParam.Name := 
"Additional value";
    MetaModelDesc.SaveDescriptor;
    
// Create a problem parameter
    ProblemDesc := Mb.ItemByIdNamespace("PROBLEM", Mb.GetObjectKeyById("CONT_MODEL")).EditDescriptor;
    ProblemDesc.Params.Clear;
    pParam := ProblemDesc.Params.Add;
    pParam.Id := 
"ADDITIONAL";
    pParam.Name := 
"Additional value";
    
// Set up metamodel parameter management via problem parameter
    Control := ProblemDesc.Params.ControlInfo.FindByKey(MetaModelDesc.Key);
    ParamControl := Control.FindByKey(pParam.Key);
    ParamControl.Expression.AsString := 
":" + ParamControl.ControlledParam.Id;
    ProblemDesc.SaveDescriptor;
    
// Set parameter to send value to metamodel
    MetaModel := MetaModelDesc.Edit As IMsMetaModel;
    MetaModel.Params.Clear;
    ModelParam := MetaModel.Params.Add;
    ModelParam.Id := 
"ADDITIONAL";
    ModelParam.Name := 
"Additional value";
    ModelParam.ObjectParam := mParam;
    (MetaModel 
As IMetabaseObject).Save;
End Sub UserProc;

A parameter is created for the problem and the metamodel on executing the example. The metamodel parameter is managed via the problem parameter. The parameter value, which will be specified on problem opening, will be passed to the metamodel and can be further for calculation.

See also:

IMsModelParam