Need code to Duplicate OI's Lostfocus---]write--]clear form (OpenInsight Specific)
At 11 NOV 1998 10:16:37AM Steve C. wrote:
It looks like I need to recreate OI's write event handler in a
subroutine after changing one part of a multi-part key record.
I need to be asked if I want to save or delete the record
with the old ID and then save that record with the new changed ID.
I will probably be doing this by capturing the lostfocus event
of each Key part and if changed do my processing. If anyone has
the coding in a subroutine that will do this I would certainly
appreciate the help instead of reinventing the wheel.
I'll buy you a beer at the next RevSoft conference I attend.
Thanks…
Steve C.
At 11 NOV 1998 12:13PM Don Bakke wrote:
Steve,
We did this for an inventory window so the users could easily change the name of the part (which is the key). I'm pretty sure the same principle would apply to your situation. Instead of multiple LOSTFOCUS events, just use the READ event since it will get triggered for every key ID change. Also, you'll need to control the READ event anyways to suppress the reading of a new record in the case of a rename.
Here is the code from our window. I haven't changed it so it might take some effort to sift through it to get to relevant logic you need. If you have any questions just let me know. (BTW, I'll take a Pepsi instead of beer if you don't mind. )
<code> $insert APP_INSERTS Ans=1 Inv_no=Get_Property(@Window:".EDL_INV_NO", "TEXT") Current_ID=Get_Property(@Window, "ID") Current_record=Get_Property(@Window, "RECORD") If Inv_no1, 1 EQ "?" then Ans=0 end else If (Inv_no NE Current_ID) AND (Current_ID NE "") then Open "FAA_INVENTORY" to FAA_INVENTORY then Read Record from FAA_INVENTORY, Inv_no else Response=1 Response=Msg(@Window, "", "RENAME_INVENTORY") If Response EQ 1 then Write Current_record to FAA_INVENTORY, Inv_no then Delete FAA_INVENTORY, Current_ID then Open "FAI_INVENTDESC" to FAI_INVENTDESC then Read Record from FAI_INVENTDESC, Current_record then Swap Current_ID with Inv_no in Record Write Record to FAI_INVENTDESC, Current_record else rv=Msg(@Window, "Error: Unable to write ":Current_record:" to the FAI_INVENTDESC table.") end end end else rv=Msg(@Window, "Error: Unable to open the FAI_INVENTDESC table.") end end else rv=Msg(@Window, "Error: Unable to delete ":Current_ID:" from the FAA_INVENTORY table.") end end else rv=Msg(@Window, "Error: Unable to write ":Inv_no:" to the FAA_INVENTORY table.") end end end end else rv=Msg(@Window, "Error: Unable to open the FAA_INVENTORY table.") end end end Return Ans</code>
dbakke@srpcs.com