Promoted Write Problem (OpenInsight 32-bit Specific)
At 27 FEB 2004 07:36:30PM Barbara F Evans wrote:
I need help with a promoted event that is not working correctly.
On several forms, I have 3 buttons…one each for write, delete, and cancel. I have promoted events for each procedure, following the recommendations for setting up promoted events using the function approach as I understand the procedures as documented on this forum. I have functions PE_Write, PE_Delete, and PE_Cancel that call a Promoted_Events routine with the appropriate Send_Event code.
The delete and cancel both work fine on all forms, but the write returns the Read/Write message "All key values empty". The changes entered on the form, however, have been updated to the record. It is as if the write event is being fired twice…once writing the record and clearing the form and then trying to write again.
These windows originally had the send write event as part of a button script that has since been removed and replaced with a quick event to execute the procedure. Is there some place the originally compiled code is still hanging around? I even added a new button doing the same write procedure in case that was the case, but I get the same error message.
The key field is an SSN for which I have a validation/conversion SSN_FORMAT routine. Thinking this might be part of the problem, I disabled it entirely to test these forms and I still get the same result.
Thanks for any suggestions?!
At 28 FEB 2004 01:57AM Donald Bakke wrote:
Barbara,
I would agree that you are experiencing the results of the WRITE event being fired twice. I'm a bit confused about what exactly the QuickEvent of your Write button is doing. Is it sending a WRITE event to the current window or are you explictly calling PE_Write (which I understand to be your promoted WRITE event)? If it is the latter, then this might very well be the problem because promoted events are generally triggered by the system rather than being called directly. This isn't meant to be critical, but I appears that you might not have a complete grasp on the nature of events in OpenInsight, which is pretty important if you are going to use promoted events.
Another common mistake programmers make that causes this problem is to put a Forward_Event() call in the script or promoted WRITE event and then forgetting to return 0 to abort the system level WRITE event again.
I'm happy to help you work through this. Please let me know if there is more information that will be helpful.
At 28 FEB 2004 02:55AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
We believe that Don is on the right track but that your description might be unintentionally misleading. From reading your description it seems as though you may not actually have promoted an event at all. This has a very specific meaning as detailed back in '97 here and as expanded upon by SRPCS in '02 here and refers to an event that triggers for more than one control.
You refer to having implemented a "commuter" style approach which is commendable. The problem is that QUICK events are the very last thing in the event hierarchy to fire, AFTER system events. So by the time you get to YOUR quick event the system WRITE has already happened. Thus when you send another WRITE to the form it has already cleared the form and there are no values in the key prompts! Thus in the case of Write events you have to call your Commuter Event from the script itself and the Return 0 from the script to cancel the system write.
For a discussion of this event flow please see the Online Help, "Guide To Application Development", "Event Driven Programming", "Flow of Event Handling" et seq. This should make the foregoing more clear.
World Leaders in all things RevSoft