I remember...glad it's working so far.
Enter Find Mode
Setfield [Table1:: PrivSetName;Get(PrivelegeSetName)]
You might also want to add this same script to a button on the layout labeled "ShowAll". It won't 'show all records'...but it would show all the records that you're allowed to see. ;)
Does this work for you?
Good memory Ninja.
I wrote this script like you have it and when I performed this script from a remote computer this script finds all records except for those created by this privilege set?? I'm wondering if it's because when this account name signs in, the field "privsetname" is set to auto enter this privilege set(Montgomery). Just a thought.
A picky (but very very important) detail...you say
"when this account name signs in, the field "privsetname" is set to auto enter this privilege set(Montgomery)."
I trust that you mean the FIELD is set to autoenter upon creation...not on login. If it's part of your opening script...remove it immediately. Set the Field Properties to autoenter Get(Privelege Set Name) on creation...NOT a Setfield() on the opening script. In the opening script going to defeat your purpose.
A side note: If your script is running with "Run script with full access priveleges" box checked...the Get(Privelege Set Name) function will return "FullAccess" rather than "Montgomery". Make sure the box is not checked in Scriptmaker.
Does this fix it up?
You are correct, the privsetname field is auto enter upon creation not log in.
This brings me to another question.
Now that I have my account names assigned to their repective set privilege, I would like to have an opening script so that when the each user signs it the script
will prompt for the user name & password. Or is there a better way to accomplish this? Keep in mind that I am running FMP 10 and I am the host file, all other users are FMP 9.
You say "so that when the each user signs it the script will prompt for the user name & password"
The sign in process just prompted for username and password. Why would you want to do it again in your opening script? The login process sets the user's privilege set, what are you trying to accomplish with a second "login"?
Well since you have such a good memory I was expecting you to read my mind.
I want to place an icon on each user's desktop to open this file(This icon will trigger an open file script), therefore the file isn't opened yet until they click on the icon. I assume, in order for this file to password protected, this script needs to prompt for user name & password.
I'm going to answer this with a great big "I Think so" before and after.
Assuming you're on PC so you can put said icon (shortcut) on each desktop. They would still be opening an FMP database and would have to log on BEFORE the opening script runs. That's why you set up individual accounts in the first place right? You DID do this right? That's where "Montgomery" came from...right?
Thus if they have to log into the Dbase before the script even runs, you don't need to do it again during the script.
"I think so"
Try it...make sure I know what I'm talking about...I'm not sure on this one, especially if you're on a Mac. Put an icon on the desktop and open it...what happens? If you log into the Dbase with username and password, you can cross this task off the list...
Enjoy the day!
I want to get back to finding privilege sets in an opening script please please.
This is what I have in a database file called "Quoter"
We have six remote locations ( or branches with one of those being "Montgomery")
A prvilege set name called "branch name" is assigned to each user, depending on their location. The privilege set name limits each user from accessing records created by the other privilege set names.
A field called "Privsetname" captures the privilege set name upon record creation.
This is what I need to accomplish.....
Suppose Privilege Set name "Montgomery" created 15 records in this file "Quoter"
and another Privilege set name "Athens" created 100 records and another "Birmingham" created 200 records and so on. Therefore, the next time the user with the privilege set name of "Montgomery" or "Athens" or "Birmingham" logs in, I want the find script to show only the records created by the privelige set name the user is assigned to. I don't want all the records to be shown, eventhough the off limit records show no access. I just think this is a waste and there should be a better solution. If it helps at all, can I send you this file?
Please see my first post on this thread. Take that three-line script segment and place it as the last three lines of your script that runs on opening the Database. That will accomplish what you describe.
Conceptually, you will not "remove" the records from Athen's view, you will have Athens working inside of a found-set of records defined by [PrivSetName=Athens]. The find would be performed automatically because you have the script doing the find running automatically on startup. If Birmingham goes to the top menus and selects "Show All Records", the will see ALL records, but 115 of them will have <No Access> in the fields. That's why you would put a button labeled "SHOW ALL" on the layout which DOES NOT show all records, it ACTUALLY performs the three-step script above (or simply runs the opening script over again) resulting in a found set. None of your users would work with all records being shown, they would all be working within a found set.
Try out the three step script on a dummy account with Privilege set "Athens" and check it out...I think you'll find that either it does what you're trying to do.
I have a few records created by a previlegesetname = Montgomery.
I wrote this script like you have. To try this script to see if would work I signed on a remote pc as this privilege name Montgomery. Before I did this I included the field privsetname in the layout. But when I ran this script it came back as finding no matching records, however when this error message was showing, I can see that the privsetname field had "Montgomery" in that field. I'm stumped.
Is this the only thing your startup script does? I use this "found set" method all the time and have not had issue with it. If your startup does other stuff, put pause script steps in to isolate the issue.
If this find is all it does, triple check that the field contents, Privilege set name, and SetField instructions all match up...They probably do, but check just the same. Remember that a space is a character...do you have a space in the Privilege set name...or something else hard to spot?
Even better, log in remote under the Montgomery PrivSet, create two dummy records, log out, then log back in. It sould at least find the two dummy records...
Please let me know how you're making out...
I believe I have tried every possible combo and I still can not get it to work.
Now when I sign in on a remote pc with an account that has full privileges and run the script it works perfectly. But when I sign in as the account name with "Montgomery" privilege set name the same error comes back as an error stating that no matching sets were found.
Assuming you did the two-dummy-records thing along with everything else you could think of, it sounds like there is something in the "Montgomery" Privilege Set that won't let part of the script do what you're telling it to do. I would look through the PrivSet itself, with a printout of the script in hand, and make sure that the PrivSet itself isn't blocking you...walk step by step through the script and check that the Montgomery PrivSet allows that step. I further assume that the "Athens" PrivSet has the same exact issue, as do the other PrivSets...
That's the only thing left (that comes to my mind anyway) that would allow a [FullAccess] account to work perfectly while the Montgomery PrivSet does not. Is there something in the PrivSet settings that won't let the script run a certain step...a "GoToLayout", a "SetField" which is modifying a record (shouldn't be an issue in Find Mode), something else in the PrivSet settings?
I've been out of the office for a couple of weeks and got back on this PrivilegeSetName situation.
After wrestling with the "Montgomery" privilege set name I found that the only way the find script
works is the following combination in the custom privileges;
Custom Record Privileges: View = "Yes", Edit = "Get(PrivilegeSetName)", Create = "Yes", Delete = "No", Field Access = "All"
If I change the View back to "Get(PrivilegeSetName)" limitation the find will not find any matching records.