Page 1 of 1

Script problem when 'Export Records' priviledge not allowed

PostPosted: Thu Sep 15, 2005 3:39 am
by David Fox
FM6 running on local machines with FM Server hosting database.

Hello All,

I have a thorny problem with a script which will not run correctly unless I allow "EXport Records" in the Passwords setup.
Allowing Export Records has become a security issue for the client.

The Script relates to two files, A Company File and a People File.
The People file contains all the people belonging to the respective companies contained in the Company File.
The people are linked to the companies via a unique key number originating in the Company file.

What the script does is to allow a user to find and display all people belonging to any companies they have just
found in the Company file. The resulting people are (and must) be displayed in the People file.

It works as follows:
In the Company file there is a layout called 'Key Util'containing just the Company Key Number field .
There is another layout called 'Key paste' which contains a Global Text field called 'GBLtxt'.
There is a relationship between the Company file and the People file called "All_People" based on the 'GBLtxt' field in the Company file
and the unique key number in the People file (as mentioned above).

The script is as follows:

Set error Capture (on)
Enter browse mode()
Go to layout ("key Util")
Copy All Records
Go to layout ("key Paste")
Paste (Select, "GBLtxt")
Go to layout (original layout)
Go to Related Record(Show, "All_People")
Perform Script (Sub-scripts, External: "People".fp5(*)")

The external script just goes to the relevant list layout in the People file.

The good thing about this script is that it does not involve the editing in any significant way of any records so the script
does not come across any problems with other users being in any records the script wants to use.

The BIG problem is that for some reason this script will not run properly without the Export Records priviledge being allowed. I need to stop this priviledge.

Can anyone help with a solution here which maintains the functionality but allows me to disallow the Export Records priviledge to users?

Sorry to be so long-winded but it's a bit of an odd one and a new one on me.

Many thanks for any help.

David

PostPosted: Thu Sep 15, 2005 4:09 am
by John Sindelar
BTW, there is a way to do this in FM8 where you can GoToRelatedRecords for a found set.

In other versions, though, you've definitely run into something. The "CopyAllRecords" step really does an export of sorts (the results, if had more than 1 field on the "copy" layout, would be a tab-delimited export of the found set, just to your clipboard instead of to a file).

You'll have to build your string of company IDs by looping through the found company records and setting the company IDs into GBLtxt one by one.

There are other ways to do this, btw, but they all also involve Export privileges. For instance, you could have performed an "update import" from the People file, matching on the Company Key Number, and importing some global filed from Company into People. A side effect of the import is that the found set reflects the imported- in this case, the "matched"- records.

Thanks for the very clear post.

PostPosted: Thu Sep 15, 2005 6:14 am
by David Fox
John,

Thank you very much for this. I've just redone the script to loop through and it's fine and although a bit slower, the client's happy and so am I!

It was a strange one wasn't it?

Many thanks once again.

David