November 30, 200718 yr hi, i have a little problem I could use some help with. I am a new user (1 month) and have created a patient management database for the hospital department I work for. Its a simple one table database. I am worried that someone might delete a record by mistake or even all records by mistake. I know I can disable deleting but there is one user account I would like to give deleting privileges to. I thought a simple solution would be to remove deleting privileges for that account but create a script that would move that specific record to another table. That way the record would appear deleted but would actually just have been moved. How could I create a script to do this? Or if someone has a better solution please let me know since I am very new at this. Thanks Yalon Edited November 30, 200718 yr by Guest
November 30, 200718 yr I think a more straightforward way of doing this is to simply create a field called 'status' and toggle this between 'active' or 'inactive'. Have startup script do a find to display only the 'active' fields or view the table through a relationship which requires that 'status' be equal to 'active' to be matched. Have a button that toggles the status from active to inactive and omits the record when you want to 'discard' it. You can create addtional scripts to restore inactive records by toggling their status back to active.
November 30, 200718 yr Author this sounds like a great solution. I have successfully created a "status" field and a button associated with a custom dialog script that changes status to "inactive" from default of "active" when the "yes" button within the custom dialog is selected. Show Custom Dialog [ Title: "Delete Patient Record"; Message: "Are you sure you want to delete this patient record?"; Buttons: "Cancel" , "Yes" ] If [ Get ( LastMessageChoice ) = 2 ] Replace Field Contents [ hn database original data::Status ; Replace with calculation: "inactive" ] [ No dialog ] Else Exit Script [ ] End If Now how do i make "inactive" records not searchable? I did not understand the rest of your post. Thank you. addendum: I changed user access for all users but myself to only be able to view records if they are "active". Now the inactive ones are still viewable however all fields contain "NO DATA" message in them. Can I make them not viewable at all, even when ppl search for them? Edited November 30, 200718 yr by Guest
December 1, 200718 yr Yalon In your start up script, you need to add a find request. Enter find mode set field; "Status";"Inactive" perform find show omit Status being your status field Only the records that are not mark inactive will be shown. Be sure to hide the status area or the user will be able to toggle between the inactive and active records. In the exit script, add the function "Show all records" Hope this helps Lionel Edited December 1, 200718 yr by Guest
December 1, 200718 yr Author Beautiful, works like a charm. I also added a find button that runs a find script that sets "status" field to "active" and then searches within these "active" patienst only. Otherwise, running the find command would return all records including "inactive" ones. I'm curious as to why you suggested I add "Show all records" to my exit script. Any particular reason?
December 2, 200718 yr Yalon Because as you add new records and change some records to inactive, you want to make sure that you get to view all active records. Lionel
Create an account or sign in to comment