[RDMLX]Hooking OnAction

Please do not use to report errors- use your regional help desk.
Please mark posts as being for RPG or RDMLX (LANSA) developer.
To subscribe by email, display this forum, scroll to the end and select ‘Subscribe Forum’.
Post Reply
MegumiSawada
Posts: 268
Joined: Tue Feb 19, 2013 5:18 pm

[RDMLX]Hooking OnAction

Post by MegumiSawada »

Hi,

Is it possible to detect Action Name when hooking on Action by Form.OnAction?

I've set local operation AAAA to the command of an offline formviews and its action is set to 'AAAA'.
It seems I can write #COM_OWNER.Set_OP_ExecScript Event('/Form.OnAction') but not #COM_OWNER.Set_OP_ExecScript Event('/Form.OnAction.AAAA') .
When I tap AAAA command, error message says "Unable to find local form with the specified name 'AAAA' Please ensure the name is correct and the form with that symbolic name exists."

Best Regards,
Megumi Sawada
tsupartono
Posts: 289
Joined: Wed Apr 18, 2012 10:21 am

Re: [RDMLX]Hooking OnAction

Post by tsupartono »

Megumi,
You can't do Form.Action.AAAA as that is not a valid form (OnAction expects an operation).
You'd need to set the Form.OnAction to your ExecScript operation.
Then inside your JavaScript ECL, you'd check what action was invoked.
LongRange assigns the invoked action to the "action" form variable, so you'd need to get the value of this variable, using q_receiveVars function.
Please see the code example below:

Code: Select all

lrexec(
function()
{
   q_receiveVars("action");
},
function()
{
   // Requested variables are now available in the current "this" context
   // To access the "action" variable, we can say "this.action"
   var myAction = this.action;
}
. . .
Post Reply