Binding: Variant;
The Binding property determines the display settings for parameter value editor.
Editor parameters are set using the connection line. To get the connection line, use the IBindingValue.AsString property.
Executing the example requires that the repository contains a database with the BD identifier, as well as the User_Method module that contains a user method template.
Sub Main;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Kont: IMsModelSpace;
Templates: IMsUserMethodTemplates;
Template: IMsUserMethodTemplate;
TemplateParams: IMsUserMethodTemplateParams;
TemplateParam: IMsUserMethodTemplateParam;
Begin
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_MODELSPACE;
CrInfo.Id := "Kont_Model";
CrInfo.Name := New modeling container;
CrInfo.Parent := MB.Root;
MObj := MB.CreateObject(CrInfo).Edit;
Kont := MObj As IMsModelSpace;
//DB configuration
Kont.Database := MB.ItemById("BD").Bind As IDatabase;
//Period configuration
Kont.StartDate := DateTime.ComposeDay(2000, 1, 1);
Kont.EndDate := DateTime.AddYears(Kont.StartDate, 10);
//Template of user method
Templates := Kont.UserMethodTemplates;
Template := Templates.Add;
Template.Assembly := MB.ItemById("User_Method");
Template.ClassName := "My_Method";
//Template parameters
TemplateParams := Template.Params;
TemplateParam := TemplateParams.Add;
TemplateParam.Binding := """UI=""FloatEdit""";
TemplateParam.Name := First parameter;
TemplateParam := TemplateParams.Add;
TemplateParam.Binding := """UI=""FloatEdit""";
TemplateParam.Name := Second parameter;
MObj.Save;
End Sub Main;
After executing the example a modeling container is created in the root directory of repository. The calendar period for this container is set to 10 years, one template is created in the list of templates of the user methods. Two parameters are created for the template.
See also: