Page 1 of 1
Detect RAMP Navigation in progress
Posted: Fri Feb 21, 2020 8:27 am
by rgjohnson
We have code that needs to execute in the onArrive of a RAMP script but ONLY if the screen is going to be presented to the user. If the onArrive is executing because RAMP is in the process of Navigating to a destination screen and is just "passing through" the current screen on the way to some other destination screen we do not want to execute this particular code.
Is there some RAMP or global variable/object we can check from a screens onArrive script to determine whether or not RAMP is in the middle of navigating to some other screen?
Re: Detect RAMP Navigation in progress
Posted: Thu Mar 05, 2020 4:06 pm
by Taku Izumi
If the scenario of screen navigation is the following, I check the oPreviousForm
Screen A(J) -> Screen X(S) -> Screen B(D)
Screen C(J) -> Screen X(S) -> Screen E(D)
onArrive script of Screen X is
Code: Select all
/* ====================================================== */
/* ================== vHandle_ARRIVE ================== */
/* ====================================================== */
/* Handle arrival at this SPECIAL */
/* oPayload: The payload supplied by the event initiator */
/* oPreviousForm: Reference to previous object Form */
vHandle_ARRIVE: function(oPayload, oPreviousForm)
{
var bReturn = true;
HIDE_CURRENT_FORM();
SETBUSY(true);
/* <ARRIVE /> - Do not remove or alter this line */
if (oPreviousForm.vName == "Screen A")
{
SETVALUE("txtOption","1",1);
SENDKEY(KeyEnter);
}
if (oPreviousForm.vName == "Screen C")
{
SETVALUE("txtOption","2",1);
SENDKEY(KeyEnter);
}
return(bReturn);
},
Regards,
Taku
Re: Detect RAMP Navigation in progress
Posted: Mon Mar 09, 2020 12:00 pm
by Tim McEntee
Hi
There is a variable for the target destination form for the current navigation that can be tested but it is volatile and probably not recommended for use.
The method I use is to hard code the command handler name in the arrive script. If for one Command Handler I expect the RAMP script to stop at this destination I execute one set of scripts. I rarely treat destinations as junctions, but with that approach you would execute a different set of code.
if ((objCommand.uUserObjectType == "MYCOMMANDHANDLER") || (objBusinessObject.uUserObjectType != 'CUSTOMERS')) {
... Destination arrive code ...
} else {
... Junction Arrive code ...
}
Tim