Resource: IResourceObject;
The Resource property determines resources from which text values are taken depending on the used repository language.
Sub UserProc;
Var
MB : IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
Des: IMetabaseObjectDescriptor;
Obj: IMetabaseObject;
Shp: ISharedParams;
Params: IMetabaseObjectParams;
Pa: IMetabaseObjectParam;
Begin
MB := MetabaseClass.Active;
Mb.SpecialObject(MetabaseSpecialObject.SharedParams) := Null;
//create a global variables area
CrInfo := Mb.CreateCreateInfo;
CrInfo.Id := "MyParam";
CrInfo.Name := "MyParam";
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_SHAREDPARAMS;
CrInfo.Parent := MB.ItemById("OBJ19645");
CrInfo.Permanent := False;
Des := Mb.CreateObject(CrInfo);
Obj := Des.Edit;
Shp := Obj As ISharedParams;
Shp.IsShared := True;
Shp.Resource := MB.ItemById("Resource").Bind As IResourceObject;
Shp.NameResource := "SHARA";
Params := Shp.Params;
//create a parameter
Pa := Params.Add;
Pa.Id := "GLOBAL_INT";
Pa.DataType := DbDataType.Integer;
Pa.DefaultValue := 15;
Obj.Save;
End Sub UserProc;
After executing the example the global variable is created, its name depends on the repository language set. The string resource should have the SHARA_GLOBAL_INT identifier in the resource editor (the Resource identifier).
See also: