Probe(Dimension: IOrmSimpleClass;
Attribute: IOrmSimpleAttr): Boolean;
Probe(Dimension: Prognoz.Platform.Interop.Orm.IOrmSimpleClass;
Attribute: Prognoz.Platform.Interop.Orm.IOrmSimpleAttr): boolean;
Dimension. Object implemented by the IOrmSimpleClass interface. Dictionary or MDM repository can be passed as parameter value.
Attribute. Attribute implemented by the IOrmSimpleAttr interface that should be checked. Dictionary attribute or attribute of MDM dictionary can be passed as parameter value.
The Probe method checks attribute and returns whether it is possible to search by the given attribute.
This method must be redetermined in custom class. If this method returns True, the search is based on this attribute, otherwise, it does not.
To use this method, set the IDimTextCriteria.CriteriaOptions property to SearchProbeAttributes.
Executing the example requires a form, a button named Button1 positioned on this form, the RdsDictionaryBox component named RdsDictionaryBox1 and the UiRdsDictionary component used as a data source for RdsDictionaryBox1. The MDM dictionary linked to the UiRdsDictionary component, contains the Name and UserAttr attributes.
Class TestForm: Form
Button1: Button;
UiRdsDictionary1: UiRdsDictionary;
RdsDictionaryBox1: RdsDictionaryBox;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
RdsInst: IRdsDictionaryInstance;
Search: IRdsDictionaryElementsSearch;
Crit: IDimTextCriteria;
Keys: IRdsDictionaryElementArray;
Begin
RdsInst := RdsDictionaryBox1.Source.Instance;
Search := RdsInst.CreateSearch;
Crit := New DimTextCriteria.Create;
Crit.CriteriaOptions := TextCriteriaOptions.SearchProbeAttributes
Or TextCriteriaOptions.FreeText;
Crit.SimpleProbe := New MyProbe.Create;
Crit.Text := "Population income";
Search.SetTextCriteria(Crit);
Keys := Search.FindAll;
End Sub Button1OnClick;
End Class TestForm;
Class MyProbe: Object, IDimSimpleAttrProbe
Public Function Probe(Dimension: IOrmSimpleClass; Attribute: IOrmSimpleAttr): Boolean;
Begin
Return (Attribute.Id = "NAME") Or (Attribute.Id = "USERATTR");
End Function Probe;
End Class MyProbe;
After executing the example clicking the button creates an object for finding MDM dictionary elements. Search condition is selected. Attributes by values of which the search should be performed are defined using the Probe custom method. The system object of custom class MyProbe is used as checking object. After search the Keys variable contains the array of found elements keys.
Executing the example requires a .NET form, a button named Button1 positioned on this form, the RdsDictionaryBoxNet component named RdsDictionaryBoxNet1 and any UiRdsDictionaryNet component that is a data source for RdsDictionaryBoxNet1. The MDM dictionary linked to the UiRdsDictionaryNet component, contains the Name and UserAttr attributes.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Orm;
Imports Prognoz.Platform.Interop.Rds;
…
Public Partial Class TestForm: Prognoz.Platform.Forms.Net.ForeNetForm
Public Constructor TestForm();
Begin
InitializeComponent();
End Constructor;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
RdsInst: IRdsDictionaryInstance;
Search: IRdsDictionaryElementsSearch;
Crit: DimTextCriteria;
Keys: IRdsDictionaryElementArray;
Begin
RdsInst := RdsDictionaryBoxNet1.Source.Instance;
Search := RdsInst.CreateSearch();
Crit := New DimTextCriteria();
Crit.CriteriaOptions := TextCriteriaOptions.tecropSearchProbeAttributes
Or TextCriteriaOptions.tecropFreeText;
Crit.SimpleProbe := New MyProbe();
Crit.Text := "Population income";
Search.SetTextCriteria(Crit);
Keys := Search.FindAll();
End Sub;
End Class;
Class MyProbe: Object, IDimSimpleAttrProbe
Public Function Probe(Dimension: IOrmSimpleClass; Attribute: IOrmSimpleAttr): Boolean;
Begin
Return (Attribute.Id = "NAME") Or (Attribute.Id = "USERATTR");
End Function Probe;
End Class MyProbe;
After executing the example clicking the button creates an object to find element in MDM dictionary. Search condition is selected. Attributes by values of which the search should be performed are defined using the Probe custom method. The system object of custom class MyProbe is used as checking object. After search the Keys variable contains the array of found elements keys.
See also: