Newbies Barry B Posted February 26, 2004 Newbies Posted February 26, 2004 Hello, I'm new to the forum and to filemaker. I have been learning quickly, but I have not found this issue covered yet. I would like to create a set of radio buttons "LOCKED" and "UNLOCKED" to control access to changing field data in my project. I would like it to default to unlocked when I start a new record, and then automatically switch to locked when I select to save this record and start a new one. Any help would be great.
mborgens Posted February 27, 2004 Posted February 27, 2004 A different way is to make a duplicate layout that doesn't show in your layouts. Use that layout to add and modify info. In the visible layout set the fields to not allow access. cheap, quick and easy. Use a script to create a new record. The script can set your radio field to unlocked. The script would check the field to access the layout, e.g., If "radio field" = "unlocked" Goto Layout "Unlocked Layout." After you're finished have a button to complete. This button can set the radio field to "locked." This isn't needed to you create the hidden entry layout. Mark
Jarvis Posted March 2, 2004 Posted March 2, 2004 Barry, Here is a way of locking specific fields. You have to do this for each field you create and it is probably easier to do it as you create the field. The locking is basically created by a series of validation type steps for each field. I got this idea from an example file that started out from Larry Dykstra. I don't know where I got the file and I haven't figured out how to compress it so I can attach it, so I will just paraphrase it: 1) Create a text field called: LOCKSTATUS 2) Create a SET FIELD script that sets the field LOCKSTATUS to be equal to "LOCKED". You might also want a set field script that sets the value to "UNLOCKED". 3) Produce a button to activate the SET FIELD scripts. 4) Create any new field you want then: 5) Select the Validation Tab for the dialog box 6) Check ? Validated by calculation 7) Check ? Strict: Do not allow user to overide data validation 8) Check ? Display custom message if validation fails (This is optional) 9) Hit the SPECIFY button for the calcuation then enter the following calculation: [lockedstatus <> "locked"] After all your fields have been filled out activate the LOCKED/UNLOCKED button. If the value "LOCKED" is selected, your user will not be able to change the data after it has been entered. There are probably bunches of ways to control access to the lock status buttons. Hope this helps. Jarvis
stanley Posted March 2, 2004 Posted March 2, 2004 Jarvis: That is really very cool, especially because it locks the data no matter what layout you are in. However, because you're using a text field for LOCKSTATUS, you are locking/unlocking on a field-by-field basis. If LOCKSTATUS is a global, then you're locking the file as a whole. In that case, on a FM Server solution, if LOCKSTATUS is set to "locked" when the solution is first deployed, the default setting would be for nobody to be able to alter data until/unless they have switched to "unlocked." I like that alot. -Stanley
HazMatt Posted March 2, 2004 Posted March 2, 2004 In my solution, I have a text field "lock_status" that accepts either "Locked" or "Unlocked" as a result of a script. If I had to do it over again, I would make it a number field that defaults to "0" (unlocked) and is set to "1" (locked) when a script is run. The reason I don't care about the actual text is because I use a little calc container field that shows a picture of a lock that is [green and unlocked], and [red and locked]. Also, using numbers makes it really easy to create a calc field that counts the number of locked records in a found set. The negative part of this whole thing is that you have to remember to assign the field validation on EVERY FIELD you want affected. I forget to do that a lot of the time.
Jarvis Posted March 2, 2004 Posted March 2, 2004 MDLarson, I like your idea about the number field in lieu of a text field. I'm not sure where I would have the need to count fields that are locked but I do like the flexibility. Stanley has a good idea about making th lockstatus field global. I tried it as a rudimentary password type protection and it worked pretty good. I did not try dressing it up with a calculation field that made you enter a "secret" value, but I am sure it could be done. This morning I am thinking about the merits of having several validation type aspects. The global validation would let you get into the file but the individual text validations would provide more spot protection. Thanks for your input, Jarvis
Recommended Posts
This topic is 7641 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