BaseContext :: executeAction - Execute action
The function can be called in order to execute a specific action. The function allows calling actions defined in dictionary resources (e.g. window actions).
Since actions might be implemented in different ways, the action type can be passed to the function. Function calls without eActionType parameter refer to function (or expression) actions. Expressions are always called prior to implemented functions.
The function returns -1 when no appropriate action could be found. When the action had been executed successfully, the function returns 0 , which usually indicates that not further processing is required (e.g. when handling events). In case of errors or incomplete processing, 1 will be returned. In this case, events calling the action are passed to the next event handler.
The action executed cannot return a value directly to the caller. Instead, the caller may obtain the action result by calling result() . When no value has been set in the result string, result() returns an empty string.
When the context handle does not refer to a valid context instance the function throws an exception.
context.executeAction("allIncome","Miller,Paul",","); // remove Paul Miller
output(context.result());
The value is usually returned from context functions or actions in order to report the result of execution. The variable may contain following values:
- -1: function/action not executed
- 0: function executed normally
- 1-9: Function executed with errors. Error codes depend on the function/action called.
Implementation overview
- Calling action by name
BaseContext :: executeAction ( sActionName, eActionTypes ) - Execute context function
BaseContext :: executeAction ( sActionName ) - Calling function action with parameter list
BaseContext :: executeAction ( sActionName, sParmList ) - Call function action with separated parameter string
BaseContext :: executeAction ( sActionName, sParameter, sSeparator ) - Call function action with parameter string
BaseContext :: executeAction ( sActionName, sParameter )
Implementation details
-
Calling action by name
int32 BaseContext  :: executeAction ( odaba::String &sActionName, odaba::ActionTypes eActionTypes )
The function can be called in order to execute the action with the name passed in sActionName . Since action names are not unique, an action type has to be passed in eActionType in order to identify the action.
- sActionName
- Action name
The action name is a name of an action implemented in the context class related to the database source or implemented as default action. Actions can be implemented as expressions, as C++ functions or as .NET function.
In order to pass no action name, an empty string ( String () ) may be passed.
- eActionTypes
- Action type
The action type defines the type of action to be executed (function, program etc.) In case of undefined action type function is assumed.
to list
- sActionName
- Action name
-
Execute context function
int32 BaseContext  :: executeAction ( odaba::String &sActionName )
The function passed in sActionName can be called in order to execute an action implemented as OSI expression or function. In order to pass parameters to the action, one or more string parameters can be passed to the context ( setParm() or setupParm() ) before calling the function.
A more simple way of passing parameters is passing parameters directly.
context.setParm("Miller,Paul",",");
context.executeAction("Remove"); // remove Paul Miller
output(context.result());
- sActionName
- Action name
The action name is a name of an action implemented in the context class related to the database source or implemented as default action. Actions can be implemented as expressions, as C++ functions or as .NET function.
In order to pass no action name, an empty string ( String () ) may be passed.
to list
- sActionName
- Action name
-
Calling function action with parameter list
int32 BaseContext  :: executeAction ( odaba::String &sActionName, odaba::StringList &sParmList )
The function passed in sActionName can be called in order to execute an action implemented as OSI expression or function.Parameters might be passed in the parameter list.
- sActionName
- Action name
The action name is a name of an action implemented in the context class related to the database source or implemented as default action. Actions can be implemented as expressions, as C++ functions or as .NET function.
In order to pass no action name, an empty string ( String () ) may be passed.
- sParmList
- Parameter list
Parameters passed in a string list. In some cases, parameters containing spaces have to be quoted.
to list
- sActionName
- Action name
-
Call function action with separated parameter string
int32 BaseContext  :: executeAction ( odaba::String &sActionName, odaba::String &sParameter, odaba::String &sSeparator )
The function passed in sActionName can be called in order to execute an action implemented as OSI expression or function.Parameters might be passed in the parameter list.
The parameter string passed in sParameter contains a list of parameters separated by a separator value passed in sSeparator . Only the first character from sSeparator is interpreted as separator character and should no be part of any parameter value in the string.
context.executeAction("allIncome","Miller,Paul",","); // remove Paul Miller
- sActionName
- Action name
The action name is a name of an action implemented in the context class related to the database source or implemented as default action. Actions can be implemented as expressions, as C++ functions or as .NET function.
In order to pass no action name, an empty string ( String () ) may be passed.
- sParameter
- Parameter value
Parameter values allow passing one or more parameters in a parameter string. Usually, parameters are separated by spaces. Parameters containing spaces have to be quoted using double quotes.
- sSeparator
- Separator character
The separator character defines the type of character separated position parameters.
to list
- sActionName
- Action name
-
Call function action with parameter string
int32 BaseContext  :: executeAction ( odaba::String &sActionName, odaba::String &sParameter )
The function passed in sActionName can be called in order to execute an action implemented as OSI expression or function.Parameters might be passed in the parameter list.
The parameter string passed in sParameter contains a list of parameters separated by default separator.
- sActionName
- Action name
The action name is a name of an action implemented in the context class related to the database source or implemented as default action. Actions can be implemented as expressions, as C++ functions or as .NET function.
In order to pass no action name, an empty string ( String () ) may be passed.
- sParameter
- Parameter value
Parameter values allow passing one or more parameters in a parameter string. Usually, parameters are separated by spaces. Parameters containing spaces have to be quoted using double quotes.
to list
- sActionName
- Action name