FormulaKey: Integer;
The FormulaKey property returns formula key.
Executing the example requires a form, a button with the Button1 name and the Memo component with the Memo1 name. Memo1 should contain formula of XML code type. The repository must contain a time series database with the OBJ_RUBRICATOR identifier that contains a formulas dictionary.
Click the button to execute the example.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
mb: IMetabase;
Rub: IMetabaseObject;
RubInst: IRubricatorInstance;
ForLoo: IRubricatorFormulasLookup;
formulaData: IRubricatorFormulaData;
Begin
mb := MetabaseClass.Active;
Rub := mb.ItemById("OBJ_RUBRICATOR").Edit;
RubInst := Rub.Open(Null) As IRubricatorInstance;
ForLoo := RubInst.CreateFormulasLookup;
ForLoo.WhereXML := Memo1.Text;
formulaData := ForLoo.LookupData;
Memo1.Clear;
If formulaData <> Null
Then Memo1.Text := Formula is found. Formula key: + formulaData.FormulaKey.ToString;
Else Memo1.Text := Formula is not found;
End If;
End Sub Button1OnClick;
After executing the example a new object is created that searches for formula in the time series database by specified XML code. If formula is found, its key is displayed in Memo1.
See also: