1 Reply Latest reply on May 7, 2013 10:51 PM by philmodjunk

    Help with a report script

    DadCraw

      Title

      Help with a report script

      Post

           I have a report script that starts with opening a layout to select a date range.

           Once a date range is selected they pick a Company (one of our clients)

           It processes a query and sums up some information.

            

           The issue I have is I need to modify this based on the user that is logged in. For the time being I'm ok with hard coding this into the report script. It's just one employee (contractor) that needs this filtered.

           Would it be best to break the script into three parts or a really big IF statement?

           Solution A: I start the script by checking the username logged in. IF it equals my contractor then go to contractor_script which then only looks up client groups where our field called AcctMgr matches the contractor's last name and only those are displayed. Else go to my old script.

           Solution B: Wrap the current script into an IF statement. IF the username equals my contractor set a global variable based on where the contractor's last name matches the last name of our AcctMgr field that manages that client. Else set the global variable to what it is now, all the client records.

           A more permanent solution would be to tie users to the group table and only let them see information for their clients only via a relationship or lookup throughout ALL the layouts. That would be a pretty massive change that I'm not comfortable with until I finish the filemaker pro 12 training book.

           I'm new to FM, like it so far. Can't wait to get into the web publishing part.

           Want to say thanks in advance for anyone that give me some guidance. We're in a pinch and I've become THE db guy.

        • 1. Re: Help with a report script
          philmodjunk

               Most of this can be managed through settings in the contractors security settings in Manage | Security.

               See "Editing record access privileges" in FileMaker Help and check out this particular sub section: "Entering a formula for limiting access on a record-by-record basis" for a description of how to set this up.

               With those settings, any find performed by a script or by the contractor will automatically omit records for which they are not granted access.