OnVariableFound Event

Top  Previous 




Applies to





procedure(Sender : TObject; const varName : String; var RetVal : NUMBER) of Object;





OnVariableFound event handler is used to return the value of an undeclared variable on demand.


If OnVariableFound event handler is not assigned, TbcParser requires that variables are predefined prior to Parse( ) operation. However, if OnVariableFound event handler is assigned, Parser will tolerate undefined variables in the expression. After parse, when the expression's value is requested, TbcParser will invoke OnVariableFound event handler for each variable that was not previously assigned a value for.


When OnVariableFound is event handler is present, it is the user's responsibility to decide whether a variable is valid or not, and decide what the current value of the variable shall be.


OnVariableFound event is useful in cases when the application domain is too big to define all possible variables that can be used in a mathematical expression ahead of time.