yalon Posted November 30, 2007 Posted November 30, 2007 (edited) 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, 2007 by Guest
Matthew F Posted November 30, 2007 Posted November 30, 2007 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.
yalon Posted November 30, 2007 Author Posted November 30, 2007 (edited) 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, 2007 by Guest
The Big Bear Posted December 1, 2007 Posted December 1, 2007 (edited) 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, 2007 by Guest
yalon Posted December 1, 2007 Author Posted December 1, 2007 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?
The Big Bear Posted December 2, 2007 Posted December 2, 2007 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
Recommended Posts
This topic is 6203 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now