Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 23 FEB 1999 05:59:58PM Gene Sorbo wrote:

Hello again,

There's got to be something simple (?) I'm missing here, maybe those of you with more OI experience can shed some light.

Here's the current problem (OI development version 3.61.):

I am developing an OI based Human Resource Information System (HRIS).

I have a form bound to a database table. The user either enters the key directly into a drop down combo box, or chooses the key from an index lookup that is called when the user clicks the dropdown arrow. So far so good. However, BEFORE the controls on the form are populated with data, I want to trap the key value (don't need the rest of the record) in a stored procedure to check to see if the user has access to the specific record (as reflected in a custom OI security table).

I've coded the procedure, but no matter where I hook it, it DOES NOT execute until AFTER the data is presented in the panel (i.e. too late). I have tried hooking it to the window's READ event and

the key field's LOSTFOCUS and CHANGED events. In all cases, the procedure runs fine - AFTER the data is populated.

I discovered that the same code placed in a LOSTFOCUS quick event script on the key field works just fine. However, I have many forms that will use this code, and would prefer to call it generically from a stored procedure.

I have read some of the postings here and the OI documentation that suggest using SEND_EVENT to simulate AREVs pre/post read processing - but I have not found the example code clear enough on how to implement (i.e., substitute my READ processing for window READ…). Is this what's required here? I have browsed the WORKSHOP/CUSTOMER/EXAMPLES applications but did not run into anything similar enough.

Thanks in advance for any and all help with this.

Gene Sorbo

Employee Management Systems

[email protected]


At 23 FEB 1999 06:50PM [email protected] wrote:

Gene,

]]]I discovered that the same code placed in a LOSTFOCUS quick event script on the key field works just fine. However, I have many forms that will use this code, and would prefer to call it generically from a stored procedure.

To me the LostFocus event is the best place to put this code. If you want to make your routine into a stored procedure great. Write your routine as a function then execute it from the key of your controls.

In Lostfocus Event ..

Declare Subroutine Forward_Event

Declare Function SecurityFunction

If SecurityFunction(pass what you need) Then

  Forward_Event(Flag,FocusId)

End

Return 0

By having your RETURN 0 then the forward event will continue processing if your 'securityfunction' return true.

We have a subroutine in each of our Got/Lost focus events which performs a specific function for every control and then branches as needed for special processing.

Does this hit what you need? If not could you further define why you don't want to use the LostFocus Event.

[email protected] onmouseover=window.status=imagine !!!;return(true)"

David Tod Sigafoos ~ SigSolutions

voice: 503-639-8080


At 23 FEB 1999 08:00PM Gene Sorbo wrote:

David,

I will give your method a shot. Thanks.

Problem I guess is that I was attempting to trigger the stored procedure (subroutine) DIRECTLY (as in Quickevent option "Execute a Procedure") from the lostfocus event on the key field - not via the event script associated with lostfocus. Apparently, this will not work…?

I was hoping to stay away from needing to create the same lostfocus event script for each form, but will venture there if need be.

Thanks for your help on this.

Gene


At 23 FEB 1999 08:16PM [email protected] wrote:

Gene,

I'm probably being dense here but you are going to have to have some script (single line) or a QuickEvent

OR

you could create a LostFocus Event which happens in all windows exactly the same. This happens when you create a 'global' event. I would strongly suggest not doing this as it is not only tricky but got/lost events are .. cantankerous(sp?).

Our GotFocus_LostFocus subroutine is called from a single line of code .

I am not sure how you would get an event to process (except from a global window event) without at least 1 line of code or the quickevent.

If you find something different please let me know

[email protected] onmouseover=window.status=imagine .. ;return(true)"

David Tod Sigafoos ~ SigSolutions

voice: 503-639-8080


At 23 FEB 1999 08:27PM Gene Sorbo wrote:

David,

You pointed me in the right direction and I've got it working great!

In a quick event script associated with lost focus, I simply put:

CALL HRIS_SECURITY('SECURITY_CHECK')

which calls my stored procedure HRIS_SECURITY, and process the SECURITY_CHECK branch, all BEFORE any READ processing for the form occurs…!

At least now, I can make as many enhancements/changes as I want to the HRIS_SECURITY stored procedure, and NOT have to update the event script for each and every form calling it.

Thanks for your help.

Gene


At 24 FEB 1999 09:58AM Cameron Purdy wrote:

Gene,

QuickEvents are executed too late in most cases to stop the system processing. You need to code the event and either forward (or return 1) if the security test passes otherwise return 0 without forwarding.

I would suggest placing such logic on the READ event, since that is the action you want to prevent.

Cameron Purdy

Revelation Software

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/69c2a57a78fc7b3d85256721007e5744.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1