I think that you need to pick up the field privilege_set by the correct relationship, and by the List function, so:
PatternCount ( List ( RealationshipToThatTable::privilege_set ; "Administrator" )
I gave that a try but still no result as before, the calc I tried is
PatternCount ( List( USERS::privilege_set ) ; "Administrator" ).
The relationship I have is a cartesian (x) as Admin table has only one record but there can be many users. (The Admin table holds most globals and common calculations and the user portal is on a tab in one of it's layouts.)
The Users portal holds a list of users. When the create new user script is run, it creates a new record in the users table and uses the data to create a new account for the file. This all works well except for the possibilty of creating two Administrators, this is a security issue as this privilege alone has price edit access.
I am hoping this is something simple I'm overlooking, I'll keep trying
It was something simple I overlooked after all
I needed a summary of your calculation, now I can test the summary and it works fine.
Thanks again for your help
How does the account get created? I let users create accounts for their systems. I catch the User name they want, the password they want, and the Access Level (Priviledge Set) they want. They can chose 1, 2, or 3 (as explained in the dialogue.) A script checks for what Access Level they asked for, and adds the user name to that Privilege set. The access level 4 (administrator) is not open to them.
How do you give the first administrator the privilege? Does that come with the file? In which case you can simply ban anyone creating another one (see above). Do they have to create the first one themselves? In which case mark that creation in the Preferences file, and use the script to check for that. Once it's created, "No more administrators can be created, thank you"
I was using two seperate buttons with script parameters. With staff turnover in mind I wanted them to be able to change the administrator easily without my help.
I think you're right though, I fell into the trap of overthinking it.
A simple flag during the script will only take 1 field where mine now takes 2 and more processing. The reverse in deleting the administrator is simpler too. Sorry I was too quick with the tick, just got excited when it worked. I'll change it to your method now