onestopbusiness Posted September 14, 2010 Posted September 14, 2010 probably a simple question... but what I'd like to know is how to set a field's value based on the Privilege Set that a user is a member of... For instance, user A is a Member of Privilege Set A..so upon logging in...any new records created automatically set the Location field to A...etc..etc.. Thhnx in advance
Chris Cain Posted September 14, 2010 Posted September 14, 2010 Use get ( privilegesetname ) in your auto-enter calculation.
onestopbusiness Posted September 14, 2010 Author Posted September 14, 2010 Hmm...not sure I understand that. sorry to be so obtuse. I have a field in my Db called Location that uses a value list. Denver, New York etc... I'd like to make it so that when a user logs in that is part of say the Denver privilege set...the Location field automatically gets set to Denver when they create a new record...if they're part of the New York set it gets set to New York. is get(privilegesetname) a valid function parameter? I'm not familiar with it.
bcooney Posted September 14, 2010 Posted September 14, 2010 Do you have a users table? If so, use an Open Script that finds the User using Get (accountname) and then publishes their locationID to gLocationID. Btw, I would not use New York, Denver, but rather IDs that come from the Locations table. In each table, create a LocationIDCreated field that has as an auto-enter calc, gLocationID.
onestopbusiness Posted September 14, 2010 Author Posted September 14, 2010 uh...I don't have anything quite so complex. I have no users table or locations table The users are setup using Filemaker's default Manage Security. And the locations are in a simple value list at the moment.
bcooney Posted September 14, 2010 Posted September 14, 2010 You could put a LocationCreated field in each table, auto-enter calc, and a case statement, but that will spread your logic out. For example, if you decided that you want to change the Location that is associated with a privset in new records, you'd have to change every calc field in every table. This isn't hard. Create a Locations table, LocationID and Location. Use that to create the value list, just showing the second field. Create a user table. Now you can directly tie Users and Locations with a LocationID in the User table. Also create an AccountName in the User table and enter their accountname. I also include PrivSet, but that's bcs I script Account creation. In a script that runs on Open, go to a layout based on Users, enter Find mode and set AccountName to Get(accountname). Perform Find. Now you're at the user record, at can set all sorts of values to global fields or $$vars.
onestopbusiness Posted September 14, 2010 Author Posted September 14, 2010 good lord....I was hoping for something simple like..if user is member of privilege set X set field (location) to X etc..etc..was thinking it would be as easy as adding some if thens to a startup script?
bcooney Posted September 14, 2010 Posted September 14, 2010 Alright. Keeping it simple. Yes, in a startup script, create a section: If ( Get (PrivilegeSetName) = X Set $$location, "New York" elseif ( get (privsetname) = Y Set $$location, "London" etc endif Then, in each table, you'd have a LocationCreated field with an auto-enter, $$location.
Recommended Posts
This topic is 5242 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