VLF-One: RAMP Session Started
VLF-One: RAMP Session Started
I was wondering if there was an easy way to detect if a ramp session has been started in a filter for a business object. I have a business object that has multiple filters and I was using the avRAMP_StartSession to signal an event to tell the filter that ramp has started, but if I switch between filters, the new filter will not have received that event so it won't know.
-
Tim McEntee
- Posts: 57
- Joined: Thu May 26, 2016 8:46 am
Re: VLF-One: RAMP Session Started
Hi,
I can't see a way of doing this easily. There are a couple of options that I can think of:
1) Set a flag when the initial RAMP event is fired, so when you switch filters you check the flag. To handle multiple RAMP sessions you would have to get creative, using maybe the Business Object to identify what has been opened. This would also require you to fire an event from the RAMP session when it ends. It is possible to make this work, but you may have problems with the flag getting out of sync of the open session.
2) You can signal an event to a RAMP session and if alive it will signal back. It's a bit convoluted but there is no real way of connecting a Filter or Command Handler to a particular RAMP session via RDML code.
You could combine this with the flag.
In all of my destination screens I add this code at the bottom:
/* ====================================================== */
vHandle_AVEVENT: function(WithId,Sender,WithAInfo1,WithAInfo2,WithAInfo3,WithAInfo4,WithAInfo5,WithNInfo1,WithNInfo2,WithNInfo3,WithNInfo4,WithNInfo5)
{
switch (WithId) {
default:
SHARED.commonHandle_AVEVENT(WithId,Sender,WithAInfo1,WithAInfo2,WithAInfo3,WithAInfo4,WithAInfo5,WithNInfo1,WithNInfo2,WithNInfo3,WithNInfo4,WithNInfo5);
break;
}
return(true);
},
Then in the uf_sy420_RTS.js I add a function - this way I can add a common event handler for all screens:
commonHandle_AVEVENT: function(WithId,Sender,WithAInfo1,WithAInfo2,WithAInfo3,WithAInfo4,WithAInfo5,WithNInfo1,WithNInfo2,WithNInfo3,WithNInfo4,WithNInfo5)
TRACE("commonHandle_AVEVENT WithId,WithAInfo1,WithAInfo2", WithId, WithAInfo1, WithAInfo2);
switch (WithId) {
case 'ISSESSIONALIVE':
if (WithAInfo1 == objBusinessObject.uUserObjectType) { /* condition may be needed if TO('FRAMEWORK') is used */
AVSIGNALEVENT('SESSIONISALIVE', 'BUSINESSOBJECT ', objBusinessObject.uUserObjectType , '...any other relevant info...');
}
break;
default:
break;
}
},
In my filter you signal RAMP (try to BUSINESSOBJECT first but you may have to signal to the FRAMEWORK).
#COM_OWNER.avSignalEvent Withid('IsSessionAlive') Ramp(True) Sendainfo1(#LTCCommandHandler.avObjectType) TO('BUSINESSOBJECT')
Wait on the response - if no response then the session is not active. If there is a response then it is active.
EVTROUTINE Handling(#Com_owner.avEvent) Withid(#WithID) Withainfo1(#AInfo1) Withainfo5(#AInfo5)
CASE Of_Field(#WithID.UpperCase)
WHEN Value_Is(= 'SESSIONISALIVE')
... add your session alive code here ...
ENDCASE
ENDROUTINE
Tim
I can't see a way of doing this easily. There are a couple of options that I can think of:
1) Set a flag when the initial RAMP event is fired, so when you switch filters you check the flag. To handle multiple RAMP sessions you would have to get creative, using maybe the Business Object to identify what has been opened. This would also require you to fire an event from the RAMP session when it ends. It is possible to make this work, but you may have problems with the flag getting out of sync of the open session.
2) You can signal an event to a RAMP session and if alive it will signal back. It's a bit convoluted but there is no real way of connecting a Filter or Command Handler to a particular RAMP session via RDML code.
You could combine this with the flag.
In all of my destination screens I add this code at the bottom:
/* ====================================================== */
vHandle_AVEVENT: function(WithId,Sender,WithAInfo1,WithAInfo2,WithAInfo3,WithAInfo4,WithAInfo5,WithNInfo1,WithNInfo2,WithNInfo3,WithNInfo4,WithNInfo5)
{
switch (WithId) {
default:
SHARED.commonHandle_AVEVENT(WithId,Sender,WithAInfo1,WithAInfo2,WithAInfo3,WithAInfo4,WithAInfo5,WithNInfo1,WithNInfo2,WithNInfo3,WithNInfo4,WithNInfo5);
break;
}
return(true);
},
Then in the uf_sy420_RTS.js I add a function - this way I can add a common event handler for all screens:
commonHandle_AVEVENT: function(WithId,Sender,WithAInfo1,WithAInfo2,WithAInfo3,WithAInfo4,WithAInfo5,WithNInfo1,WithNInfo2,WithNInfo3,WithNInfo4,WithNInfo5)
TRACE("commonHandle_AVEVENT WithId,WithAInfo1,WithAInfo2", WithId, WithAInfo1, WithAInfo2);
switch (WithId) {
case 'ISSESSIONALIVE':
if (WithAInfo1 == objBusinessObject.uUserObjectType) { /* condition may be needed if TO('FRAMEWORK') is used */
AVSIGNALEVENT('SESSIONISALIVE', 'BUSINESSOBJECT ', objBusinessObject.uUserObjectType , '...any other relevant info...');
}
break;
default:
break;
}
},
In my filter you signal RAMP (try to BUSINESSOBJECT first but you may have to signal to the FRAMEWORK).
#COM_OWNER.avSignalEvent Withid('IsSessionAlive') Ramp(True) Sendainfo1(#LTCCommandHandler.avObjectType) TO('BUSINESSOBJECT')
Wait on the response - if no response then the session is not active. If there is a response then it is active.
EVTROUTINE Handling(#Com_owner.avEvent) Withid(#WithID) Withainfo1(#AInfo1) Withainfo5(#AInfo5)
CASE Of_Field(#WithID.UpperCase)
WHEN Value_Is(= 'SESSIONISALIVE')
... add your session alive code here ...
ENDCASE
ENDROUTINE
Tim
Re: VLF-One: RAMP Session Started
Hey Tim, Thanks for the response. I ended up doing something pretty much like you suggested for option 1. I used the clipboard to set a flag with the business object name as part of the key. Then when the filter/instance pane is closed, I delete the clipboard entry. I'm somewhat would have thought there would be a class/property that we could refer to in order to check. Guess not.
Re: VLF-One: RAMP Session Started
You might be able to use these in your own custom system manager to track starts and stops.
https://docs.lansa.com/14/en/lansa048/i ... 8_8220.htm
That way any of your code shoudl be able to check the status.
Remember that there can be more than one active session though.
https://docs.lansa.com/14/en/lansa048/i ... 8_8220.htm
That way any of your code shoudl be able to check the status.
Remember that there can be more than one active session though.