ProLinga Tutorial |
---|
When pressing the "Delete" button, we want to delete the record currently displayed on the screen. We have to perform some tests first. We have to check if a record is loaded and if so ask confirmation of the user if the record really can be removed. Finally the physical removal of the record if the user confirms.
IF F-deviceNumber.Device = 0 ERROR "Please enter a Device Number." FOCUS entryDeviceNumber RETURN ENDIF IF V-isPresentDevice = FALSE() ERROR "No Device loaded." RETURN ENDIF ERROR "Are you sure you want to remove Device: " CLIP(F-deviceNumber.Device) "?" SEVERITY Question IF ERRORRETURN() <> 0 RETURN ENDIF LET O-Device = R-Device DATAMODEL REMOVE Device IF DATAMODELSTATUS() <> 0 ERROR "Error removing Device." RETURN ENDIF LET V-isPresentDevice = FALSE() CLEAR RECORD Device DISPLAY ALL MESSAGE "Device has been removed."
We have seen all ProLinga statements before, so you should be able now to read this logic. Save the function as "DeviceDelete" and test your application.
The first part of your application is now fully functional. In the next chapters we will make a search mechanism for a Device, in case the user does not know a Device Number.
<< Logic: DeviceOK | Variable Group Search >> |