CreateSimpleClass(Dimension: ): IDimOrmClass;
CreateSimpleClass(Dimension: Prognoz.Platform.Interop.Orm.IOrmSimpleClass): Prognoz.Platform.Interop.Dimensions.IDimOrmClass;
Dimension. Dictionary implemented by the interface IOrmSimpleClass. Dictionary structure or MDM dictionary structure can be passed as parameter value.
The CreateSimpleClass method creates an object used to work with conditions of element search in dictionaries and MDM dictionaries.
Executing the example requires an MDM repository with the MDM identifier. This repository contains an MDM dictionary with the Dict_1 identifier.
Sub UserProc;
Var
MB: IMetabase;
RdsDict: IRdsDictionary;
RdsDictInst: IRdsDictionaryInstance;
OrmMan: IDimOrmManager;
OrmClass: IDimOrmClass;
Condition: IDimOrmCondition;
Crit: IDimTextCriteria;
Elems: IRdsDictionaryElements;
Elem: IRdsDictionaryElement;
i: Integer;
Begin
MB := MetabaseClass.Active;
RdsDict := MB.ItemByIdNamespace("Dict_1", MB.ItemById("RDS").Key).Bind As IRdsDictionary;
RdsDictInst := RdsDict.Open(Null);
OrmMan := New DimOrmManager.Create;
OrmClass := OrmMan.CreateSimpleClass(RdsDict As IOrmSimpleClass);
Condition := OrmClass.CreateCondition;
Crit := New DimTextCriteria.Create;
Crit.CriteriaOptions := TextCriteriaOptions.SearchStringAttributes Or TextCriteriaOptions.FreeText;
Crit.Text := "Data";
Condition.SetTextCriteria(Crit);
Elems := RdsDictInst.Elements;
For i := 0 To Elems.Count - 1 Do
Elem := Elems.Item(i);
Debug.WriteLine(Elem.Name + ": Satisfies search conditions - " +
Condition.EvaluateRec(Elem.Record).ToString);
End For;
End Sub UserProc;
Executing the example creates an object used to work with search conditions in selected dictionary. Element search condition is selected. Next, all elements are checked for meeting the search conditions. Element names and checking results are displayed in development environment console.
Executing the example requires an MDM repository with the MDM identifier. This repository contains an MDM dictionary with the Dict_1 identifier. It also should contain a .NET form, a button named Button1 positioned on this form, and the TextBox component named TextBox1.
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
MB: IMetabase;
RdsDict: IRdsDictionary;
RdsDictInst: IRdsDictionaryInstance;
OrmMan: IDimOrmManager;
OrmClass: IDimOrmClass;
Condition: IDimOrmCondition;
Crit: DimTextCriteria;
Elems: IRdsDictionaryElements;
Elem: IRdsDictionaryElement;
i: Integer;
ElemList: List <string>;
Begin
MB := Self.Metabase;
RdsDict := MB.ItemByIdNamespace["Dict_1", MB.ItemById["RDS"].Key].Bind() As IRdsDictionary;
RdsDictInst := RdsDict.Open(Null);
OrmMan := New DimOrmManager.Create();
OrmClass := OrmMan.CreateSimpleClass(RdsDict As IOrmSimpleClass);
Condition := OrmClass.CreateCondition();
Crit := New DimTextCriteria();
Crit.CriteriaOptions := TextCriteriaOptions.tecropSearchStringAttributes
Or TextCriteriaOptions.tecropFreeText;
Crit.Text := "Data";
Condition.SetTextCriteria(Crit);
Elems := RdsDictInst.Elements;
ElemList := New List < string >();
For i := 0 To Elems.Count - 1 Do
Elem := Elems.Item[i];
ElemList.Add(Elem.Name + ": Satisfies search conditions - " +
Condition.EvaluateRec(Elem.Record).ToString());
End For;
TextBox1.Lines := ElemList.ToArray();
End Sub;
Clicking the button after executing the example creates object to work with search conditions in selected dictionary. Element search condition is selected. Next, all elements are checked for meeting the search conditions. Element names and the results of checking are displayed in the TextBox1 component.
See also: