September 14, 201015 yr 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
September 14, 201015 yr Author 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.
September 14, 201015 yr 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.
September 14, 201015 yr Author 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.
September 14, 201015 yr 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.
September 14, 201015 yr Author 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?
September 14, 201015 yr 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.
Create an account or sign in to comment