CreateSimpleCondition(
Dimension: IOrmSimpleClass;
Criteria: IDimTextCriteria): IDimOrmCondition;
CreateSimpleCondition(
Dimension: Prognoz.Platform.Interop.Orm.IOrmSimpleClass;
Criteria: Prognoz.Platform.Interop.Dimensions.DimTextCriteria): Prognoz.Platform.Interop.Dimensions.IDimOrmCondition;
Dimension. Dictionary implemented by the interface IOrmSimpleClass. Dictionary structure or MDM dictionary structure can be passed as parameter value.
Criteria. Element search criterion.
The CreateSimpleCondition method creates an object for working 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;
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;
Crit := New DimTextCriteria.Create;
Crit.CriteriaOptions := TextCriteriaOptions.SearchStringAttributes Or TextCriteriaOptions.FreeText;
Crit.Text := "Data";
Condition := OrmMan.CreateSimpleCondition(RdsDict As IOrmSimpleClass, 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 for working with search conditions based on selected MDM dictionary and search criterion. 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;
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();
Crit := New DimTextCriteria.Create();
Crit.CriteriaOptions := TextCriteriaOptions.tecropSearchStringAttributes
Or TextCriteriaOptions.tecropFreeText;
Crit.Text := "Data";
Condition := OrmMan.CreateSimpleCondition(RdsDict As IOrmSimpleClass, 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;
Executing the example creates an object for working with search conditions based on selected MDM dictionary and search criterion. 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: